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

MODULE_NOT_FOUND error after updating to latest CLI version #3031

Closed
simonhyphen8 opened this issue Sep 24, 2024 · 7 comments
Closed

MODULE_NOT_FOUND error after updating to latest CLI version #3031

simonhyphen8 opened this issue Sep 24, 2024 · 7 comments
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated

Comments

@simonhyphen8
Copy link

Note
Before you submit your issue, make sure that:

  • You're using the latest version of Salesforce CLI.
  • You've searched both open and closed issues for related posts.
  • You've used the doctor command to diagnose common issues.
  • You understand that GitHub Issues don't adhere to any agreement or SLA.
    • If you require immediate assistance, use official channels such as Salesforce Customer Support.

Summary

I was prompted to update to the latest version of the CLI. I did so and now when I run the following command:
sf package create --name PACKAGE_NAME --package-type Unlocked --path force-app
I receive an error message (see results)
I have tried the latest version of the CLI, and I installed an older version (2.43.3) and received the same result.
This was working a few weeks ago when I generated a new version of the package I am working with.

Steps To Reproduce

Update to latest version of CLI using
sf update
Try and run the package create command:
sf package create --name PACKAGE_NAME --package-type Unlocked --path force-app

IMPORTANT
Provide a repository that's configured to reproduce the issue. If you are unable to provide a repo, please explain why not. The more info we have from the start, the faster we can resolve your issue.
We may close your issue if you don't include proper instructions.

  • Generate a project with sf project generate or fork dreamhouse-lwc.
  • Provide detailed step-by-step instructions on how to reproduce the issue.

Tip

use sf doctor --create-issue to automatically fill the required information

Expected result

Package version is created
File sfdx-project.json is updated with the latest version
Package is ready to be marked as published

Actual result

Error message received:
ModuleLoadError: [MODULE_NOT_FOUND] require failed to load › /Users/MYUSERNAME/.local/share/sf/node_modules/@salesforce/plugin-packaging/lib/commands/package/create.js: Cannot find module 'glob' › Require stack: › - /Users/MYUSERNAME/.local/share/sf/node_modules/@salesforce/packaging/lib/package/packageProfileApi.js › - /Users/MYUSERNAME/.local/share/sf/node_modules/@salesforce/packaging/lib/package/packageVersionCreate.js › - /Users/MYUSERNAME/.local/share/sf/node_modules/@salesforce/packaging/lib/package/packageConvert.js › - /Users/MYUSERNAME/.local/share/sf/node_modules/@salesforce/packaging/lib/package/package.js › - /Users/MYUSERNAME/.local/share/sf/node_modules/@salesforce/packaging/lib/package/index.js › - /Users/MYUSERNAME/.local/share/sf/node_modules/@salesforce/packaging/lib/exported.js › - /Users/MYUSERNAME/.local/share/sf/node_modules/@salesforce/plugin-packaging/lib/commands/package/create.js › - /Users/MYUSERNAME/.local/share/sf/client/2.58.7-ed27925/node_modules/@oclif/core/lib/module-loader.js › - /Users/MYUSERNAME/.local/share/sf/client/2.58.7-ed27925/node_modules/@oclif/core/lib/help/index.js › - /Users/MYUSERNAME/.local/share/sf/client/2.58.7-ed27925/node_modules/@oclif/core/lib/errors/handle.js › - /Users/MYUSERNAME/.local/share/sf/client/2.58.7-ed27925/node_modules/@oclif/core/lib/errors/index.js › - /Users/MYUSERNAME/.local/share/sf/client/2.58.7-ed27925/node_modules/@oclif/core/lib/execute.js › Code: MODULE_NOT_FOUND

Additional information

System Information

Terminal = bash
OS Version = Sonoma 14.6.1 (23G93)

{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.58.7",
  "nodeVersion": "node-v20.17.0",
  "osVersion": "Darwin 23.6.0",
  "rootPath": "/Users/simonmolloy/.local/share/sf/client/2.58.7-ed27925",
  "shell": "zsh",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.2 (core)",
    "@oclif/plugin-commands 4.0.13 (core)",
    "@oclif/plugin-help 6.2.10 (core)",
    "@oclif/plugin-not-found 3.2.18 (core)",
    "@oclif/plugin-plugins 5.4.6 (core)",
    "@oclif/plugin-search 1.2.7 (core)",
    "@oclif/plugin-update 4.5.5 (core)",
    "@oclif/plugin-version 2.2.11 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.13 (core)",
    "@oclif/plugin-which 3.2.12 (core)",
    "@salesforce/cli 2.58.7 (core)",
    "apex 3.4.8 (core)",
    "api 1.2.1 (core)",
    "auth 3.6.54 (core)",
    "data 3.6.5 (core)",
    "deploy-retrieve 3.12.3 (core)",
    "info 3.4.3 (core)",
    "limits 3.3.29 (core)",
    "marketplace 1.2.25 (core)",
    "org 4.5.7 (core)",
    "packaging 1.26.3 (user)",
    "schema 3.3.26 (core)",
    "settings 2.3.16 (core)",
    "sobject 1.4.33 (core)",
    "source 3.5.18 (core)",
    "telemetry 3.6.10 (core)",
    "templates 56.3.17 (core)",
    "trust 3.7.27 (core)",
    "user 3.5.29 (core)"
  ]
}
@simonhyphen8 simonhyphen8 added the investigating We're actively investigating this issue label Sep 24, 2024
Copy link

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@github-actions github-actions bot added the validated Version information for this issue has been validated label Sep 24, 2024
@WillieRuemmele
Copy link
Member

hi @simonhyphen8 -
can you try running

sf plugins uninstall @salesforce/plugin-packaging

it looks like you manually installed that version, and it's quite old. Uninstalling it will make the CLI use the version it ships with rather than your older manually installed version

@simonhyphen8
Copy link
Author

@WillieRuemmele Thanks for the quick response.
I ran that comment, then tried the package create again. I now receive:
Error (CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY): entity type cannot be inserted: Package

@WillieRuemmele
Copy link
Member

Hmmm, well that sounds like it's being returned from the server. Do you need to "Enable Unlocked Packages and Second-Generation Managed Packages"? Or anything else in the org?

@simonhyphen8
Copy link
Author

It's a scratch org connected to our dev hub which we've been using for a few years now, so I don't think it's anything like those settings. However, I will check the settings of our dev hub right now and come back to you with what I find, just to be sure.

@simonhyphen8
Copy link
Author

I discovered my access had been changed on the dev hub. Apologies. That's been resolve now, my access has been restored and the package / package version is now created. Thanks for the quick response.

@WillieRuemmele
Copy link
Member

glad we got it working 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

2 participants