Issue with aio app add actions | Community
Skip to main content
Level 2
February 21, 2025
Solved

Issue with aio app add actions

  • February 21, 2025
  • 1 reply
  • 1247 views

I am facing an issue while trying to add actions in my Adobe I/O project using the aio app add actions command. The error I get is:

Error: Named export 'loadFile' not found. The requested module 'mem-fs' is a CommonJS module, which may not support all module.exports as named exports.

System Details:

  • Node.js Version: v22.13.1
  • npm Version: 10.9.2
  • AIO CLI Version: 10.3.2

>aio app add actions

When i try to add action, I see below error

i Installing template @adobe/generator-add-action-generices, go to https://adobe.ly/templates
i Installing npm package @adobe/generator-add-action-generic

changed 1 package, and audited 1258 packages in 17s

176 packages are looking for funding
  run `npm fund` for details

22 vulnerabilities (5 low, 12 moderate, 5 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
√ Installed npm package @adobe/generator-add-action-generic
 »   Error: Named export 'loadFile' not found. The requested module 'mem-fs' is a CommonJS module, which may not support all module.exports as named exports.
 »   CommonJS modules can always be imported via the default export, for example using:
 »
 »   import pkg from 'mem-fs';
 »   const { loadFile } = pkg;

Any guidance or workaround would be greatly appreciated. Thanks!

Best answer by olivark

Thank you, @sarav_prakash for your suggestions.
Unfortunately, the issue is still not resolved on my current windows system. However, I tested it on my Mac with same Node, npm and AIO versions and it is working fine there. I guess that the problem might be specific to my current environment rather than the versions.

If anyone has any ideas on what could be causing this difference, It would help me better understand the issue. Thanks You!


For those still facing that issue, maybe the following can help.

 

In my case I wanted to setup an extension,

aio app init --template=@adobe/universal-editor-ui-ext-tpl

and it was erroring with the same error.

 

I ran the following command in the folder where I wanted to install from the template,

 

aio plugins install @61380/aio-cli-plugin-app-templates@2.0.1

 

Then, run again the aio app init and it worked.

 

Ref. https://github.com/adobe/aio-cli/issues/716

 

1 reply

sarav_prakash
Community Advisor
Community Advisor
February 23, 2025

Does the add action wizard load successfully for you? this is the wizard sequence for me

after selecting all action templates, I chose generator-add-action-generic similar to you. 

and provided action name. I tried add action from node22 as well and works.

 

Can you try 

  • delete `rm -rf node_modules`
  • delete `rm package-lock.json`
  • clear cache `npm cache clean --force`
  • then `npm install`

and finally add action. Looks like some dependency is obsolete in your project that is conflicting when generic-action is installed. try clearing and reinstall, maybe node will resolve dependencies rightly. 

Level 2
February 24, 2025

Thanks for the suggestions. 

Yes the action wizard is loading for me and i have selected the same options you suggested. Still facing the same issue.

 

Issue Details:

Run `npm audit` for details.
√ Installed npm package @61380/generator-add-action-generic
» Error: Named export 'loadFile' not found. The requested module 'mem-fs' is a CommonJS module, which may not support all
» module.exports as named exports.
» CommonJS modules can always be imported via the default export, for example using:
»
» import pkg from 'mem-fs';
» const { loadFile } = pkg;
»

sarav_prakash
Community Advisor
Community Advisor
February 24, 2025

is this 'mem-fs' dependency, part of your code? is it in your package.json or just loaded by some dependency? 

coz 2 months back same issue was reported and suggested to move the dependency to peer dependency.

https://github.com/yeoman/yo/issues/803#issuecomment-2552635393

 
 

worth a try if you are only adding mem-fs to your dependencies.