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

CLI fails to start when plugin with init hook installed from github #835

Closed
mdonnalley opened this issue Oct 17, 2023 · 1 comment · Fixed by #836
Closed

CLI fails to start when plugin with init hook installed from github #835

mdonnalley opened this issue Oct 17, 2023 · 1 comment · Fixed by #836
Assignees
Labels
bug Something isn't working

Comments

@mdonnalley
Copy link
Contributor

mdonnalley commented Oct 17, 2023

Describe the bug
Installing plugins with init hook from github url causes all subsequent command executions to throw ModuleLoadError and exit

To Reproduce

  1. sf plugins install https://github.com/oclif/plugin-test-esm-1
  2. sf plugins --core
» sf plugins install https://github.com/oclif/plugin-test-esm-1
? This plugin isn't signed by Salesforce. Only install the plugin if you trust its creator. Do you want to continue the installation?,
Yes
Because you approved this plugin, you can avoid future installation confirmations by adding the plugin to the unsignedPluginAllowList.json file. For details, see https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_allowlist.htm.
Installing plugin https://github.com/oclif/plugin-test-esm-1... ⣽ [2/4] Fetching packages...
warning "https://github.com/oclif/plugin-test-esm-1 > @oclif/plugin-plugins > @oclif/core > [email protected]" has unmet peer dependency "@types/node@*".
warning "https://github.com/oclif/plugin-test-esm-1 > @oclif/plugin-plugins > @oclif/core > [email protected]" has unmet peer dependency "typescript@>=2.7".
Installing plugin https://github.com/oclif/plugin-test-esm-1... ⢿ [4/4] Building fresh packages...
Installing plugin https://github.com/oclif/plugin-test-esm-1... ⡿ [3/5] Fetching packages...
warning "oclif > [email protected]" has unmet peer dependency "mem-fs@^1.2.0 || ^2.0.0".
Installing plugin https://github.com/oclif/plugin-test-esm-1... ⣟ [4/5] Linking dependencies...
warning "oclif > [email protected]" has unmet peer dependency "mem-fs@^1.2.0 || ^2.0.0".
warning "oclif > [email protected]" has unmet peer dependency "mem-fs-editor@^8.1.2 || ^9.0.0".
warning "oclif > [email protected]" has unmet peer dependency "mem-fs@^1.2.0 || ^2.0.0".
warning "oclif > [email protected]" has unmet peer dependency "mem-fs-editor@^8.1.2 || ^9.0.0".
warning "oclif > [email protected]" has unmet peer dependency "mem-fs@^1.2.0 || ^2.0.0".
Installing plugin https://github.com/oclif/plugin-test-esm-1... ⣯ [4/5] Linking dependencies...
warning "oclif > [email protected]" has unmet peer dependency "mem-fs@^1.2.0 || ^2.0.0".
Installing plugin https://github.com/oclif/plugin-test-esm-1... ⢿ [5/5] Building fresh packages...
Installing plugin https://github.com/oclif/plugin-test-esm-1... installed v0.6.0
» sf plugins --core
 ›   ModuleLoadError: [MODULE_NOT_FOUND] require failed to load
 ›   /Users/mdonnalley/.local/share/sf/node_modules/@oclif/plugin-test-esm-1/dist/hooks/init/init: Cannot find module
 ›   '/Users/mdonnalley/.local/share/sf/node_modules/@oclif/plugin-test-esm-1/dist/hooks/init/init'
 ›   Require stack:
 ›   - /Users/mdonnalley/.nvm/versions/node/v18.15.0/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/module-loader.js
 ›   - /Users/mdonnalley/.nvm/versions/node/v18.15.0/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/help/index.js
 ›   - /Users/mdonnalley/.nvm/versions/node/v18.15.0/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/flags.js
 ›   - /Users/mdonnalley/.nvm/versions/node/v18.15.0/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/cli-ux/styled/table
 ›   .js
 ›   - /Users/mdonnalley/.nvm/versions/node/v18.15.0/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/cli-ux/styled/index
 ›   .js
 ›   - /Users/mdonnalley/.nvm/versions/node/v18.15.0/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/cli-ux/index.js
 ›   - /Users/mdonnalley/.nvm/versions/node/v18.15.0/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/index.js
 ›   Code: MODULE_NOT_FOUND

Workarounds

  • Once you're in this state, you cannot uninstall the plugin using plugins uninstall - instead, you need to manually remove the plugin from ~/.local/share/<CLI>/package.json
@mdonnalley mdonnalley added the bug Something isn't working label Oct 17, 2023
@git2gus
Copy link

git2gus bot commented Oct 17, 2023

This issue has been linked to a new work item: W-14317382

@mdonnalley mdonnalley changed the title CLI fails to start when ESM plugin with init hook installed from github CLI fails to start when plugin with init hook installed from github Oct 17, 2023
@iowillhoit iowillhoit self-assigned this Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants