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

npm install is failing due to error code ERESOLVE #3098

Closed
hsinghrajawat opened this issue Nov 5, 2024 · 9 comments
Closed

npm install is failing due to error code ERESOLVE #3098

hsinghrajawat opened this issue Nov 5, 2024 · 9 comments

Comments

@hsinghrajawat
Copy link

I created a new project using the CLI and npm install is failing due to unresolvable dependencies.

% sf version --verbose --json
{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.64.8",
  "nodeVersion": "node-v20.18.0",
  "osVersion": "Darwin 23.6.0",
  "rootPath": "/usr/local/lib/sf",
  "shell": "zsh",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.6 (core)",
    "@oclif/plugin-commands 4.1.3 (core)",
    "@oclif/plugin-help 6.2.16 (core)",
    "@oclif/plugin-not-found 3.2.22 (core)",
    "@oclif/plugin-plugins 5.4.15 (core)",
    "@oclif/plugin-search 1.2.12 (core)",
    "@oclif/plugin-update 4.6.6 (core)",
    "@oclif/plugin-version 2.2.15 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.20 (core)",
    "@oclif/plugin-which 3.2.16 (core)",
    "@salesforce/cli 2.64.8 (core)",
    "apex 3.5.4 (core)",
    "api 1.3.1 (core)",
    "auth 3.6.70 (core)",
    "data 3.8.1 (core)",
    "deploy-retrieve 3.13.1 (core)",
    "info 3.4.13 (core)",
    "limits 3.3.36 (core)",
    "marketplace 1.3.0 (core)",
    "org 4.7.2 (core)",
    "packaging 2.8.12 (core)",
    "schema 3.3.37 (core)",
    "settings 2.3.24 (core)",
    "sobject 1.4.42 (core)",
    "source 3.5.21 (core)",
    "telemetry 3.6.17 (core)",
    "templates 56.3.24 (core)",
    "trust 3.7.35 (core)",
    "user 3.5.33 (core)"
  ]
}
% sf project generate -n test
target dir = /Users/hsinghrajawat/Projects
  create test/config/project-scratch-def.json
  create test/README.md
  create test/sfdx-project.json
  create test/.husky/pre-commit
  create test/.vscode/extensions.json
  create test/.vscode/launch.json
  create test/.vscode/settings.json
  create test/force-app/main/default/lwc/.eslintrc.json
  create test/force-app/main/default/aura/.eslintrc.json
  create test/scripts/soql/account.soql
  create test/scripts/apex/hello.apex
  create test/.forceignore
  create test/.gitignore
  create test/.prettierignore
  create test/.prettierrc
  create test/jest.config.js
  create test/package.json
% npm install
(node:32298) ExperimentalWarning: CommonJS module /opt/homebrew/lib/node_modules/npm/node_modules/debug/src/node.js is loading ES Module /opt/homebrew/lib/node_modules/npm/node_modules/supports-color/index.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: salesforce-app@1.0.0
npm error Found: eslint@9.14.0
npm error node_modules/eslint
npm error   dev eslint@"^9.9.1" from the root project
npm error   peer eslint@"^7.5.0 || ^8.0.0 || ^9.0.0" from @babel/eslint-parser@7.25.9
npm error   node_modules/@babel/eslint-parser
npm error     peer @babel/eslint-parser@"^7" from @lwc/eslint-plugin-lwc@1.8.2
npm error     node_modules/@lwc/eslint-plugin-lwc
npm error       dev @lwc/eslint-plugin-lwc@"^1.1.2" from the root project
npm error
npm error Could not resolve dependency:
npm error peer eslint@"^7 || ^8" from @lwc/eslint-plugin-lwc@1.8.2
npm error node_modules/@lwc/eslint-plugin-lwc
npm error   dev @lwc/eslint-plugin-lwc@"^1.1.2" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /Users/hsinghrajawat/.npm/_logs/2024-11-02T20_40_57_743Z-eresolve-report.txt
npm error A complete log of this run can be found in: /Users/hsinghrajawat/.npm/_logs/2024-11-02T20_40_57_743Z-debug-0.log
% cat /Users/hsinghrajawat/.npm/_logs/2024-11-02T20_40_57_743Z-debug-0.log
0 verbose cli /opt/homebrew/Cellar/node/23.1.0_1/bin/node /opt/homebrew/bin/npm
1 info using npm@10.9.0
2 info using node@v23.1.0
3 silly config load:file:/opt/homebrew/lib/node_modules/npm/npmrc
4 silly config load:file:/Users/hsinghrajawat/Projects/test/.npmrc
5 silly config load:file:/Users/hsinghrajawat/.npmrc
6 silly config load:file:/opt/homebrew/etc/npmrc
7 verbose title npm install
8 verbose argv "install"
9 verbose logfile logs-max:10 dir:/Users/hsinghrajawat/.npm/_logs/2024-11-02T20_40_57_743Z-
10 verbose logfile /Users/hsinghrajawat/.npm/_logs/2024-11-02T20_40_57_743Z-debug-0.log
11 silly logfile start cleaning logs, removing 1 files
12 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
13 silly logfile done cleaning log files
14 silly idealTree buildDeps
15 silly fetch manifest @lwc/eslint-plugin-lwc@^1.1.2
16 silly packumentCache full:https://registry.npmjs.org/@lwc%2feslint-plugin-lwc cache-miss
17 http fetch GET 200 https://registry.npmjs.org/@lwc%2feslint-plugin-lwc 2154ms (cache revalidated)
18 silly packumentCache full:https://registry.npmjs.org/@lwc%2feslint-plugin-lwc set size:132806 disposed:false
19 silly fetch manifest @babel/eslint-parser@^7
20 silly packumentCache full:https://registry.npmjs.org/@babel%2feslint-parser cache-miss
21 http fetch GET 200 https://registry.npmjs.org/@babel%2feslint-parser 114ms (cache revalidated)
22 silly packumentCache full:https://registry.npmjs.org/@babel%2feslint-parser set size:179330 disposed:false
23 silly fetch manifest @babel/core@^7.11.0
24 silly packumentCache full:https://registry.npmjs.org/@babel%2fcore cache-miss
25 http fetch GET 200 https://registry.npmjs.org/@babel%2fcore 47ms (cache revalidated)
26 silly packumentCache full:https://registry.npmjs.org/@babel%2fcore set size:672875 disposed:false
27 silly fetch manifest eslint@^9.9.1
28 silly packumentCache full:https://registry.npmjs.org/eslint cache-miss
29 http fetch GET 200 https://registry.npmjs.org/eslint 35ms (cache revalidated)
30 silly packumentCache full:https://registry.npmjs.org/eslint set size:1673208 disposed:false
31 silly fetch manifest jiti@*
32 silly packumentCache full:https://registry.npmjs.org/jiti cache-miss
33 http fetch GET 200 https://registry.npmjs.org/jiti 44ms (cache revalidated)
34 silly packumentCache full:https://registry.npmjs.org/jiti set size:351297 disposed:false
35 silly fetch manifest eslint@^7 || ^8
36 silly packumentCache full:https://registry.npmjs.org/eslint cache-miss
37 http fetch GET 200 https://registry.npmjs.org/eslint 8ms (cache hit)
38 silly packumentCache full:https://registry.npmjs.org/eslint set size:1673208 disposed:false
39 verbose stack Error: unable to resolve dependency tree
39 verbose stack     at #failPeerConflict (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1363:25)
39 verbose stack     at #loadPeerSet (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1356:29)
39 verbose stack     at async #buildDepStep (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:904:11)
39 verbose stack     at async Arborist.buildIdealTree (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:181:7)
39 verbose stack     at async Promise.all (index 1)
39 verbose stack     at async Arborist.reify (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:131:5)
39 verbose stack     at async Install.exec (/opt/homebrew/lib/node_modules/npm/lib/commands/install.js:150:5)
39 verbose stack     at async Npm.exec (/opt/homebrew/lib/node_modules/npm/lib/npm.js:207:9)
39 verbose stack     at async module.exports (/opt/homebrew/lib/node_modules/npm/lib/cli/entry.js:74:5)
40 error code ERESOLVE
41 error ERESOLVE unable to resolve dependency tree
42 error
43 error While resolving: salesforce-app@1.0.0
43 error Found: eslint@9.14.0
43 error node_modules/eslint
43 error   dev eslint@"^9.9.1" from the root project
43 error   peer eslint@"^7.5.0 || ^8.0.0 || ^9.0.0" from @babel/eslint-parser@7.25.9
43 error   node_modules/@babel/eslint-parser
43 error     peer @babel/eslint-parser@"^7" from @lwc/eslint-plugin-lwc@1.8.2
43 error     node_modules/@lwc/eslint-plugin-lwc
43 error       dev @lwc/eslint-plugin-lwc@"^1.1.2" from the root project
43 error
43 error Could not resolve dependency:
43 error peer eslint@"^7 || ^8" from @lwc/eslint-plugin-lwc@1.8.2
43 error node_modules/@lwc/eslint-plugin-lwc
43 error   dev @lwc/eslint-plugin-lwc@"^1.1.2" from the root project
43 error
43 error Fix the upstream dependency conflict, or retry
43 error this command with --force or --legacy-peer-deps
43 error to accept an incorrect (and potentially broken) dependency resolution.
44 error
44 error
44 error For a full report see:
44 error /Users/hsinghrajawat/.npm/_logs/2024-11-02T20_40_57_743Z-eresolve-report.txt
45 silly unfinished npm timer reify 1730580058048
46 silly unfinished npm timer reify:loadTrees 1730580058049
47 silly unfinished npm timer idealTree:buildDeps 1730580058055
48 silly unfinished npm timer idealTree:#root 1730580058055
49 verbose cwd /Users/hsinghrajawat/Projects/test
50 verbose os Darwin 23.6.0
51 verbose node v23.1.0
52 verbose npm  v10.9.0
53 verbose exit 1
54 verbose code 1
55 error A complete log of this run can be found in: /Users/hsinghrajawat/.npm/_logs/2024-11-02T20_40_57_743Z-debug-0.log

Originally posted by @hsinghrajawat in #3065 (comment)

@chrzasz
Copy link

chrzasz commented Nov 5, 2024

I am also facing this issue for npm install

# npm resolution error report

While resolving: salesforce-app@1.0.0
Found: eslint@9.14.0
node_modules/eslint
  dev eslint@"^9.9.1" from the root project
  peer eslint@"^7.5.0 || ^8.0.0 || ^9.0.0" from @babel/eslint-parser@7.25.9
  node_modules/@babel/eslint-parser
    peer @babel/eslint-parser@"^7" from @lwc/eslint-plugin-lwc@1.8.2
    node_modules/@lwc/eslint-plugin-lwc
      dev @lwc/eslint-plugin-lwc@"^1.1.2" from the root project

Could not resolve dependency:
peer eslint@"^7 || ^8" from @lwc/eslint-plugin-lwc@1.8.2
node_modules/@lwc/eslint-plugin-lwc
  dev @lwc/eslint-plugin-lwc@"^1.1.2" from the root project

$ sf -v

@salesforce/cli/2.64.8 win32-x64 node-v20.17.0

@cristiand391
Copy link
Member

thanks for reporting!
The templates repo was getting eslint bumped in the project template by dependabot, the owners of it had disabled eslint for that specific one.
This is fixed in the current RC (v2.65.8), will be promoted to stable tomorrow.

@cristiand391
Copy link
Member

sf v2.65.8 was promoted to stable 🚀

@quinnmcphail
Copy link

@cristiand391 - It looks like this issue has popped up again. Here are my versions:

~ node -v
v22.11.0
~ npm -v
10.9.0
~ sf -v
@salesforce/cli/2.66.7 darwin-arm64 node-v22.11.0

and the error message:

npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: salesforce-app@1.0.0
npm error Found: eslint@9.15.0
npm error node_modules/eslint
npm error   dev eslint@"^9.9.1" from the root project
npm error   peer eslint@"^7.5.0 || ^8.0.0 || ^9.0.0" from @babel/eslint-parser@7.25.9
npm error   node_modules/@babel/eslint-parser
npm error     peer @babel/eslint-parser@"^7" from @lwc/eslint-plugin-lwc@1.8.2
npm error     node_modules/@lwc/eslint-plugin-lwc
npm error       dev @lwc/eslint-plugin-lwc@"^1.1.2" from the root project
npm error
npm error Could not resolve dependency:
npm error peer eslint@"^7 || ^8" from @lwc/eslint-plugin-lwc@1.8.2
npm error node_modules/@lwc/eslint-plugin-lwc
npm error   dev @lwc/eslint-plugin-lwc@"^1.1.2" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.```

@megasmack
Copy link

@cristiand391 Looks like the eslint-plugin-lwc requires eslint ^8.57.0 while the root project requires eslint ^9.9.1.

https://github.com/salesforce/eslint-plugin-lwc/blob/c5d0cbbe19a6f0d56e4e0b92d29b592baf8c2988/package.json#L26

@cristiand391
Copy link
Member

@megasmack @quinnmcphail how did you all install the CLI? can you share the exact commands you used to generate project and install its deps?
I'm not able to repro (same node/npm/sf version on macos) and the deps in the project template looks good.

@megasmack
Copy link

megasmack commented Nov 19, 2024

@cristiand391
I installed SF CLI from here: https://developer.salesforce.com/tools/salesforcecli

I used the VSCode Extension to generate the project. I'm not sure which commands that uses to create a new project template.

@megasmack
Copy link

@cristiand391 Just test running sf project generate --name MyProject instead of the VSCode plugin. Ir creates a package.json using "eslint": "^8.57.0" while VSCode plugin generates a package.json using "eslint": "^9.9.1".

It appears the problem is in the VSCode plugin.

@cristiand391
Copy link
Member

@megasmack thanks for checking, can you log an issue here so the IDEx team is aware?
https://github.com/forcedotcom/salesforcedx-vscode/issues

I'll ping them

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

5 participants