Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
papiliond opened this issue Jan 23, 2025 · 11 comments

Comments

@papiliond
Copy link

papiliond commented Jan 23, 2025

aio -v: @adobe/aio-cli/10.3.2 darwin-arm64 node-v20.9.0
aio info:

  OS: macOS 15.2
    CPU: (10) arm64 Apple M1 Pro
    Memory: 361.16 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
  Virtualization:
    Docker: 27.4.1 - /usr/local/bin/docker
  npmGlobalPackages:
    @adobe/aio-cli: 10.3.2

  Proxies:
    http: (not set)
    https: (not set)
  CLI plugins:
    core:
      @adobe/aio-cli 10.3.2
      @adobe/aio-cli-plugin-app 13.1.3
      @adobe/aio-cli-plugin-app-dev 2.1.0
      @adobe/aio-cli-plugin-app-storage 1.1.0
      @adobe/aio-cli-plugin-app-templates 2.0.3
      @adobe/aio-cli-plugin-auth 4.0.1
      @adobe/aio-cli-plugin-certificate 2.0.1
      @adobe/aio-cli-plugin-config 5.0.1
      @adobe/aio-cli-plugin-console 5.0.1
      @adobe/aio-cli-plugin-events 4.0.1
      @adobe/aio-cli-plugin-info 4.0.1
      @adobe/aio-cli-plugin-runtime 7.0.1
      @adobe/aio-cli-plugin-telemetry 2.0.2
      @oclif/plugin-autocomplete 3.2.18
      @oclif/plugin-help 6.2.22
      @oclif/plugin-not-found 2.4.3
      @oclif/plugin-plugins 5.4.26
      @oclif/plugin-warn-if-update-available 3.1.31
    user:
    link:

My output on command aio app init aio-helloworld:

? Select Org: <My Org>
? Select a Project, or press + to create new: Project 1
? What templates do you want to search for? All Extension Points
✔ Downloaded the list of templates
? Choose the template(s) to install:
  Pressing <enter> without selection will skip templates and install a standalon
e application.
 (Press <space> to select, <Up and Down> to move rows)
┌──────┬─────────────────────┬─────────────────────┬─────────────┬─────────────┐
│      │ Template            │ Description         │ Extension P │ Categories  │
│      │                     │                     │ oint        │             │
├──────┼─────────────────────┼─────────────────────┼─────────────┼─────────────┤
│ ❯◯   │ @adobe/universal-ed │ Extensibility       │ universal-e │ action, ui  │
│      │ itor-ui-ext-tpl *   │ Template for        │ ditor/ui/1  │             │
│      │                     │ Universal Editor    │             │             │
├──────┼─────────────────────┼─────────────────────┼─────────────┼─────────────┤
? Choose the template(s) to install:
  Pressing <enter> without selection will skip templates and install a standalon
e application.
 (Press <space> to select, <Up and Down> to move rows)
┌──────┬─────────────────────┬─────────────────────┬─────────────┬─────────────┐
│      │ Template            │ Description         │ Extension P │ Categories  │
│      │                     │                     │ oint        │             │
├──────┼─────────────────────┼─────────────────────┼─────────────┼─────────────┤
│  ◯   │ @adobe/universal-ed │ Extensibility       │ universal-e │ action, ui  │
│      │ itor-ui-ext-tpl *   │ Template for        │ ditor/ui/1  │             │
│      │                     │ Universal Editor    │             │             │
├──────┼─────────────────────┼─────────────────────┼─────────────┼─────────────┤
? Choose the template(s) to install:
  Pressing <enter> without selection will skip templates and install a standalon
e application.

┌──────┬─────────────────────┬─────────────────────┬─────────────┬─────────────┐
│      │ Template            │ Description         │ Extension P │ Categories  │
│      │                     │                     │ oint        │             │
├──────┼─────────────────────┼─────────────────────┼─────────────┼─────────────┤
│  ◯   │ @adobe/universal-ed │ Extensibility       │ universal-e │ action, ui  │
│      │ itor-ui-ext-tpl *   │ Template for        │ ditor/ui/1  │             │
│      │                     │ Universal Editor    │             │             │
├──────┼─────────────────────┼─────────────────────┼─────────────┼─────────────┤
? Choose the template(s) to install:
  Pressing <enter> without selection will skip templates and install a standalon
e application.

┌──────┬─────────────────────┬─────────────────────┬─────────────┬─────────────┐
│      │ Template            │ Description         │ Extension P │ Categories  │
│      │                     │                     │ oint        │             │
├──────┼─────────────────────┼─────────────────────┼─────────────┼─────────────┤
│  ◯   │ @adobe/universal-ed │ Extensibility       │ universal-e │ action, ui  │
│      │ itor-ui-ext-tpl *   │ Template for        │ ditor/ui/1  │             │
│      │                     │ Universal Editor    │             │             │
├──────┼─────────────────────┼─────────────────────┼─────────────┼─────────────┤
│ ❯◉   │ @adobe/aem-assets-d │ Asset Details       │ aem/assets/ │ action, ui  │
│      │ etails-ext-tpl *    │ extension template  │ details/1   │             │
│      │                     │ for the AEM Assets  │             │             │
│      │                     │ View                │             │             │
├──────┼─────────────────────┼─────────────────────┼─────────────┼─────────────┤
│  ◯   │ @adobe/workfront-ui │ Template for AIO    │ workfront/u │ action, ui  │
│      │ -ext-tpl *          │ CLI App Builder     │ i/1         │             │
│      │                     │ plugin that allows  │             │             │
│      │                     │ generating code of  │             │             │
│      │                     │ UI Extension for    │             │             │
│      │                     │ Workfront product   │             │             │
├──────┼─────────────────────┼─────────────────────┼─────────────┼─────────────┤
│  ◯   │ @adobe/aem-cf-edito │ Extensibility       │ aem/cf-edit │ action, ui  │
│      │ r-ui-ext-tpl *      │ template for AEM    │ or/1        │             │
│      │                     │ Content Fragment    │             │             │
│      │                     │ Editor              │             │             │
├──────┼─────────────────────┼─────────────────────┼─────────────┼─────────────┤
│  ◯   │ @adobe/aem-cf-admin │ Extensibility       │ aem/cf-cons │ action, ui  │
│      │ -ui-ext-tpl *       │ template for AEM    │ ole-admin/1 │             │
│      │                     │ Content Fragment    │             │             │
│      │                     │ Admin Console       │             │             │
└──────┴─────────────────────┴─────────────────────┴─────────────┴─────────────┘

* = recommended by Adobe; to learn more about the templates, go to https://adobeBootstrapping code in: /Users/papiliond/Repos/aio-helloworld
    force package.json
    force README.md
    force jest.setup.js
    force .env
    force .gitignore
    force .eslintrc.json

Changes to package.json were detected.
Skipping package manager install.

    force .github/workflows/deploy_prod.yml
    force .github/workflows/deploy_stage.yml
    force .github/workflows/pr_test.yml
ℹ Installing template @adobe/aem-assets-details-ext-tpl
ℹ Installing npm package @adobe/aem-assets-details-ext-tpl

up to date, audited 923 packages in 2s

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

found 0 vulnerabilities
✔ Installed npm package @adobe/aem-assets-details-ext-tpl
 ›   Error: 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;
 ›
 ›       at Object.error (/Users/papiliond/.nvm/versions/node/v20.9.0/lib
 ›   /node_modules/@adobe/aio-cli/node_modules/@adobe/aio-cli-plugin-app-
 ›   templates/node_modules/@oclif/core/lib/errors/index.js:28:15)
 ›       at InstallCommand.error (/Users/papiliond/.nvm/versions/node/v20
 ›   .9.0/lib/node_modules/@adobe/aio-cli/node_modules/@adobe/aio-cli-plu
 ›   gin-app-templates/node_modules/@oclif/core/lib/command.js:103:23)
 ›       at InstallCommand.handleError (/Users/papiliond/.nvm/versions/no
 ›   de/v20.9.0/lib/node_modules/@adobe/aio-cli/node_modules/@adobe/aio-c
 ›   li-plugin-app-templates/src/BaseCommand.js:38:10)
 ›       at InstallCommand.catch (/Users/papiliond/.nvm/versions/node/v20
 ›   .9.0/lib/node_modules/@adobe/aio-cli/node_modules/@adobe/aio-cli-plu
 ›   gin-app-templates/src/BaseCommand.js:24:10)
 ›       at async InstallCommand._run 
 ›   (/Users/papiliond/.nvm/versions/node/v20.9.0/lib/node_modules/@adobe
 ›   /aio-cli/node_modules/@adobe/aio-cli-plugin-app-templates/node_modul
 ›   es/@oclif/core/lib/command.js:84:13)
 ›       at async Config.runCommand 
 ›   (/Users/papiliond/.nvm/versions/node/v20.9.0/lib/node_modules/@adobe
 ›   /aio-cli/node_modules/@oclif/core/lib/config/config.js:329:25)
 ›       at async InitCommand.installTemplates (/Users/papiliond/.nvm/ver
 ›   sions/node/v20.9.0/lib/node_modules/@adobe/aio-cli/node_modules/@ado
 ›   be/aio-cli-plugin-app/src/TemplatesCommand.js:186:7)
 ›       at async InitCommand.initWithLogin (/Users/papiliond/.nvm/versio
 ›   ns/node/v20.9.0/lib/node_modules/@adobe/aio-cli/node_modules/@adobe/
 ›   aio-cli-plugin-app/src/commands/app/init.js:174:7)
 ›       at async InitCommand.run (/Users/papiliond/.nvm/versions/node/v2
 ›   0.9.0/lib/node_modules/@adobe/aio-cli/node_modules/@adobe/aio-cli-pl
 ›   ugin-app/src/commands/app/init.js:62:7)
 ›       at async InitCommand._run 
 ›   (/Users/papiliond/.nvm/versions/node/v20.9.0/lib/node_modules/@adobe
 ›   /aio-cli/node_modules/@oclif/core/lib/command.js:117:22)
 ›       at async Config.runCommand 
 ›   (/Users/papiliond/.nvm/versions/node/v20.9.0/lib/node_modules/@adobe
 ›   /aio-cli/node_modules/@oclif/core/lib/config/config.js:329:25)
 ›       at async run 
 ›   (/Users/papiliond/.nvm/versions/node/v20.9.0/lib/node_modules/@adobe
 ›   /aio-cli/node_modules/@oclif/core/lib/main.js:89:16)
 ›       at async AIOCommand.run (/Users/papiliond/.nvm/versions/node/v20
 ›   .9.0/lib/node_modules/@adobe/aio-cli/src/index.js:30:12)
@papiliond
Copy link
Author

@shazron
Copy link
Member

shazron commented Jan 23, 2025

Seems to be an issue with https://github.com/adobe/aem-assets-details-ext-tpl I think, perhaps file the issue there, this is a template the aio-cli does not control

@papiliond
Copy link
Author

papiliond commented Jan 23, 2025

@shazron It happens on all templates and also mem-fs is a dependency of the @adobe/aio-cli package. Do you think it belongs here in this case?

@shazron
Copy link
Member

shazron commented Jan 23, 2025

All templates? I can't say I can repro your situation. I just tried installing with these as a sample:

  1. @adobe/universal-editor-ui-ext-tpl
  2. @adobe/aem-assets-details-ext-tpl

...and there were no errors.

What is more likely is - this is unique to your environment (somehow), but I'm not sure yet without digging into it more. Please post the output of aio info here to start.

Since template 2 above was successful and was the one you installed, we can rule out an issue with that template.

@papiliond
Copy link
Author

papiliond commented Jan 24, 2025

Yes, on my device after choosing any of the templates the installation throws this error. For example:

✔ Installed npm package @adobe/generator-app-api-mesh
 ›   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;
 ›
✔ Installed npm package @adobe/workfront-ui-ext-tpl
 ›   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;
 ›

@papiliond
Copy link
Author

Output of the aio info command:

    OS: macOS 15.2
    CPU: (10) arm64 Apple M1 Pro
    Memory: 361.16 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
  Virtualization:
    Docker: 27.4.1 - /usr/local/bin/docker
  npmGlobalPackages:
    @adobe/aio-cli: 10.3.2

  Proxies:
    http: (not set)
    https: (not set)
  CLI plugins:
    core:
      @adobe/aio-cli 10.3.2
      @adobe/aio-cli-plugin-app 13.1.3
      @adobe/aio-cli-plugin-app-dev 2.1.0
      @adobe/aio-cli-plugin-app-storage 1.1.0
      @adobe/aio-cli-plugin-app-templates 2.0.3
      @adobe/aio-cli-plugin-auth 4.0.1
      @adobe/aio-cli-plugin-certificate 2.0.1
      @adobe/aio-cli-plugin-config 5.0.1
      @adobe/aio-cli-plugin-console 5.0.1
      @adobe/aio-cli-plugin-events 4.0.1
      @adobe/aio-cli-plugin-info 4.0.1
      @adobe/aio-cli-plugin-runtime 7.0.1
      @adobe/aio-cli-plugin-telemetry 2.0.2
      @oclif/plugin-autocomplete 3.2.18
      @oclif/plugin-help 6.2.22
      @oclif/plugin-not-found 2.4.3
      @oclif/plugin-plugins 5.4.26
      @oclif/plugin-warn-if-update-available 3.1.31
    user:
    link:```

@papiliond
Copy link
Author

@shazron Added verbose output to the issue description. Thanks

@shazron
Copy link
Member

shazron commented Jan 24, 2025

Seems to be related yeoman/yo#803

@shazron
Copy link
Member

shazron commented Jan 24, 2025

can you run:
aio plugins install @adobe/[email protected]

and try the app init command again, then report back. Thanks!

@papiliond
Copy link
Author

It works fine now. Thank you, @shazron! 🎉

@shazron
Copy link
Member

shazron commented Jan 24, 2025

Great! That narrows it down to what I need to fix actually. Thanks for helping me debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants