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

ModuleLoadError with latest sf due to missing @salesforce/core #804

Closed
1 task done
YodaDaCoda opened this issue Mar 12, 2024 · 6 comments · Fixed by #812
Closed
1 task done

ModuleLoadError with latest sf due to missing @salesforce/core #804

YodaDaCoda opened this issue Mar 12, 2024 · 6 comments · Fixed by #812
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@YodaDaCoda
Copy link

Issue verification check:

  • is the current repository fully deployable at the commit SHA provided with the 'from' parameter of the command?

What is the problem?

Exception when using latest sf with sfdx-git-delta plugin due to missing @salesforce/core dependancy.

What is the parameter and the value you used with it?

> sf sgd source delta --from uat --output build
 »   ModuleLoadError: [MODULE_NOT_FOUND] require failed to load <snip>\node_modules\sfdx-git-delta\lib\commands\sgd\source\delta.js: Cannot find module
 »   '@salesforce/core'
 »   Require stack:
 »   - <snip>\node_modules\sfdx-git-delta\lib\commands\sgd\source\delta.js
 »   - <snip>\node_modules\@salesforce\cli\node_modules\@oclif\core\lib\module-loader.js
 »   - <snip>\node_modules\@salesforce\cli\node_modules\@oclif\core\lib\help\index.js
 »   - <snip>\node_modules\@salesforce\cli\node_modules\@oclif\core\lib\flags.js
 »   - <snip>\node_modules\@salesforce\cli\node_modules\@oclif\core\lib\cli-ux\styled\table.js
 »   - <snip>\node_modules\@salesforce\cli\node_modules\@oclif\core\lib\cli-ux\styled\index.js
 »   - <snip>\node_modules\@salesforce\cli\node_modules\@oclif\core\lib\cli-ux\index.js
 »   - <snip>\node_modules\@salesforce\cli\node_modules\@oclif\core\lib\index.js
 »   Code: MODULE_NOT_FOUND

What is the expected result?

Plugin should complete successfully, with output in build dir.

What is the actual result?

As above.

Steps to reproduce

(condensed example to ensure no other dependancies are interfering)

npm install @salesforce/cli sfdx-git-delta
node_modules/.bin/sf plugins link --no-install node_modules/sfdx-git-delta
node_modules/.bin/sf sgd source delta --from uat --output build

Execution context

Operating System: Windows 11 + Linux (Azure CI)

yarn version: N/A

node version: v20.11.0

git version: git version 2.44.0.windows.1

sfdx version: @salesforce/cli/2.30.8 win32-x64 node-v20.11.0

sgd plugin version: sfdx-git-delta 5.34.0

More information

I can resolve this by npm install @salesforce/core, but I think this should be an explicitly depenancy of this project, given it's imported in lib\commands\sgd\source\delta.js

import { Messages } from '@salesforce/core'
.

@YodaDaCoda YodaDaCoda added the bug Something isn't working label Mar 12, 2024
@scolladon
Copy link
Owner

Hi @YodaDaCoda !

Thanks for raising this issue and thanks for contributing in making this project better!

Thanks also for all the information, it is really helpful.

I am curious why this is required now... We never had to add this dependency before as it should be there with sfdx.
Plus we don't have this issue in our non regression tests...

Do you have the same issue using the latest-rc channel of the plugin ?

@scolladon scolladon added the good first issue Good for newcomers label Mar 12, 2024
@YodaDaCoda
Copy link
Author

I am curious why this is required now...

Me too. I've been using this plugin for a few years and I wasn't able to readily identify where/how the dependancy chain changed to bring about this error. It only started after updating @salesforce/cli to the latest version.

Do you have the same issue using the latest-rc channel of the plugin ?

Yes.

@scolladon
Copy link
Owner

Do you know why this issue occurs with the latest version of @salesforce/cli @mshanemc ?
Should we add this dependency from now on when we are still in the old plugin architecture like we do ?

@scolladon
Copy link
Owner

I'm still waiting on guidance here.
I don't know if the fix should be on this plugin or in the cli as it was not necessary to include @salesforce/core dependency explicitly.

@YodaDaCoda I think you could downgrade the salesforce/cli version in the mean time

@YodaDaCoda
Copy link
Author

Yeah I'd say it wasn't necessary to include it as a dependancy due to how npm structured the node_modules (something to do with peer dependancy resolution in the folder structure or something). It's not clear to me why this has changed, but if you're explicitly importing something from that package, it should be listed as a dependancy.

Copy link

Shipped in release v5.38.1.
You can install the new version using the version number or the latest-rc channel

$ sfdx plugins:install sfdx-git-delta@latest-rc
$ sfdx plugins:install sfdx-git-delta@v5.38.1

Happy incremental deployment!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants