cli icon indicating copy to clipboard operation
cli copied to clipboard

"sf project generate" command generates a new project with eslint dev dependencies broken in package.json

Open carlosabella opened this issue 11 months ago • 8 comments

Summary

When I create a new Salesforce Project using "sf project generate" command and I execute "npm install" to install dependencies, eslint dependencies are broken. I get this error: npm error code ERESOLVE npm error ERESOLVE unable to resolve dependency tree npm error npm error While resolving: [email protected] npm error Found: @lwc/[email protected] 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 @lwc/eslint-plugin-lwc@"^2.0.0" from @salesforce/[email protected] npm error node_modules/@salesforce/eslint-config-lwc npm error dev @salesforce/eslint-config-lwc@"^3.2.3" 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/carlosgarcia/.npm/_logs/2025-02-21T07_08_16_525Z-eresolve-report.txt npm error A complete log of this run can be found in: /Users/carlosgarcia/.npm/_logs/2025-02-21T07_08_16_525Z-debug-0.log

Steps To Reproduce

1.- In a terminal execute: sf project generate --name MyProject --output-dir SalesforceProjects --manifest 2.- Navigate to the folder where the project has been created. 3.- Execute in the terminal: npm install

Expected result

All dependencies installed correctly

Actual result

npm error code ERESOLVE npm error ERESOLVE unable to resolve dependency tree npm error npm error While resolving: [email protected] npm error Found: @lwc/[email protected] 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 @lwc/eslint-plugin-lwc@"^2.0.0" from @salesforce/[email protected] npm error node_modules/@salesforce/eslint-config-lwc npm error dev @salesforce/eslint-config-lwc@"^3.2.3" 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/carlosgarcia/.npm/_logs/2025-02-21T07_08_16_525Z-eresolve-report.txt npm error A complete log of this run can be found in: /Users/carlosgarcia/.npm/_logs/2025-02-21T07_08_16_525Z-debug-0.log

Additional information

"2025-02-21T07_08_16_525Z-eresolve-report.txt" log: `'Log files: /Users/carlosgarcia/.npm/_logs/2025-02-21T07_08_16_525Z-debug-0.log

npm resolution error report

While resolving: [email protected] Found: @lwc/[email protected] node_modules/@lwc/eslint-plugin-lwc dev @lwc/eslint-plugin-lwc@"^1.1.2" from the root project

Could not resolve dependency: peer @lwc/eslint-plugin-lwc@"^2.0.0" from @salesforce/[email protected] node_modules/@salesforce/eslint-config-lwc dev @salesforce/eslint-config-lwc@"^3.2.3" from the root project

Fix the upstream dependency conflict, or retry this command with --force or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.`

"/Users/carlosgarcia/.npm/_logs/2025-02-21T07_08_16_525Z-debug-0.log" log: 0 verbose cli /usr/local/bin/node /usr/local/bin/npm 1 info using [email protected] 2 info using [email protected] 3 silly config load:file:/usr/local/lib/node_modules/npm/npmrc 4 silly config load:file:/Users/carlosgarcia/Projects/SalesforceProjects/copaedge_21022025/.npmrc 5 silly config load:file:/Users/carlosgarcia/.npmrc 6 silly config load:file:/usr/local/etc/npmrc 7 verbose title npm install 8 verbose argv "install" 9 verbose logfile logs-max:10 dir:/Users/carlosgarcia/.npm/_logs/2025-02-21T07_08_16_525Z- 10 verbose logfile /Users/carlosgarcia/.npm/_logs/2025-02-21T07_08_16_525Z-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 cache https://registry.npmjs.org/@lwc%2feslint-plugin-lwc 5ms (cache hit) 18 silly packumentCache full:https://registry.npmjs.org/@lwc%2feslint-plugin-lwc set size:169309 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 92ms (cache updated) 22 silly packumentCache full:https://registry.npmjs.org/@babel%2feslint-parser set size:undefined 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 41ms (cache updated) 26 silly packumentCache full:https://registry.npmjs.org/@babel%2fcore set size:undefined disposed:false 27 silly fetch manifest [email protected] 28 silly packumentCache full:https://registry.npmjs.org/eslint cache-miss 29 http fetch GET 200 https://registry.npmjs.org/eslint 35ms (cache updated) 30 silly packumentCache full:https://registry.npmjs.org/eslint set size:undefined disposed:false 31 silly fetch manifest @prettier/plugin-xml@^3.2.2 32 silly packumentCache full:https://registry.npmjs.org/@prettier%2fplugin-xml cache-miss 33 http fetch GET 200 https://registry.npmjs.org/@prettier%2fplugin-xml 111ms (cache updated) 34 silly packumentCache full:https://registry.npmjs.org/@prettier%2fplugin-xml set size:undefined disposed:false 35 silly fetch manifest prettier@^3.1.0 36 silly packumentCache full:https://registry.npmjs.org/prettier cache-miss 37 http fetch GET 200 https://registry.npmjs.org/prettier 31ms (cache updated) 38 silly packumentCache full:https://registry.npmjs.org/prettier set size:undefined disposed:false 39 silly fetch manifest @salesforce/eslint-config-lwc@^3.2.3 40 silly packumentCache full:https://registry.npmjs.org/@salesforce%2feslint-config-lwc cache-miss 41 http fetch GET 200 https://registry.npmjs.org/@salesforce%2feslint-config-lwc 217ms (cache updated) 42 silly packumentCache full:https://registry.npmjs.org/@salesforce%2feslint-config-lwc set size:undefined disposed:false 43 silly fetch manifest @lwc/eslint-plugin-lwc@^2.0.0 44 silly packumentCache full:https://registry.npmjs.org/@lwc%2feslint-plugin-lwc cache-hit 45 verbose stack Error: unable to resolve dependency tree 45 verbose stack at #failPeerConflict (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1363:25) 45 verbose stack at #loadPeerSet (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1329:33) 45 verbose stack at async #buildDepStep (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:904:11) 45 verbose stack at async Arborist.buildIdealTree (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:181:7) 45 verbose stack at async Promise.all (index 1) 45 verbose stack at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:131:5) 45 verbose stack at async Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:150:5) 45 verbose stack at async Npm.exec (/usr/local/lib/node_modules/npm/lib/npm.js:207:9) 45 verbose stack at async module.exports (/usr/local/lib/node_modules/npm/lib/cli/entry.js:74:5) 46 error code ERESOLVE 47 error ERESOLVE unable to resolve dependency tree 48 error 49 error While resolving: [email protected] 49 error Found: @lwc/[email protected] 49 error node_modules/@lwc/eslint-plugin-lwc 49 error dev @lwc/eslint-plugin-lwc@"^1.1.2" from the root project 49 error 49 error Could not resolve dependency: 49 error peer @lwc/eslint-plugin-lwc@"^2.0.0" from @salesforce/[email protected] 49 error node_modules/@salesforce/eslint-config-lwc 49 error dev @salesforce/eslint-config-lwc@"^3.2.3" from the root project 49 error 49 error Fix the upstream dependency conflict, or retry 49 error this command with --force or --legacy-peer-deps 49 error to accept an incorrect (and potentially broken) dependency resolution. 50 error 50 error 50 error For a full report see: 50 error /Users/carlosgarcia/.npm/_logs/2025-02-21T07_08_16_525Z-eresolve-report.txt 51 silly unfinished npm timer reify 1740121696869 52 silly unfinished npm timer reify:loadTrees 1740121696871 53 silly unfinished npm timer idealTree:buildDeps 1740121696876 54 silly unfinished npm timer idealTree:#root 1740121696876 55 verbose cwd /Users/carlosgarcia/Projects/SalesforceProjects/copaedge_21022025 56 verbose os Darwin 23.6.0 57 verbose node v22.13.1 58 verbose npm v10.9.2 59 verbose exit 1 60 verbose code 1 61 error A complete log of this run can be found in: /Users/carlosgarcia/.npm/_logs/2025-02-21T07_08_16_525Z-debug-0.log

System Information

Using "zsh"
{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.77.6",
  "nodeVersion": "node-v22.13.1",
  "osVersion": "Darwin 23.6.0",
  "rootPath": "/Users/carlosgarcia/.local/share/sf/client/2.77.6-b32a695",
  "shell": "zsh",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.21 (core)",
    "@oclif/plugin-commands 4.1.20 (core)",
    "@oclif/plugin-help 6.2.25 (core)",
    "@oclif/plugin-not-found 3.2.40 (core)",
    "@oclif/plugin-plugins 5.4.31 (core)",
    "@oclif/plugin-search 1.2.21 (core)",
    "@oclif/plugin-update 4.6.31 (core)",
    "@oclif/plugin-version 2.2.23 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.33 (core)",
    "@oclif/plugin-which 3.2.29 (core)",
    "@salesforce/cli 2.77.6 (core)",
    "apex 3.6.8 (core)",
    "api 1.3.3 (core)",
    "auth 3.6.94 (core)",
    "data 4.0.11 (core)",
    "deploy-retrieve 3.18.3 (core)",
    "info 3.4.39 (core)",
    "limits 3.3.46 (core)",
    "marketplace 1.3.7 (core)",
    "org 5.2.32 (core)",
    "packaging 2.9.16 (core)",
    "schema 3.3.50 (core)",
    "settings 2.4.16 (core)",
    "sobject 1.4.50 (core)",
    "telemetry 3.6.32 (core)",
    "templates 56.3.38 (core)",
    "trust 3.7.64 (core)",
    "user 3.6.9 (core)"
  ]
}

carlosabella avatar Feb 21 '25 07:02 carlosabella

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[bot] avatar Feb 21 '25 07:02 github-actions[bot]

Hey @carlosabella, what happens if you go into the newly created package.json and update: "@lwc/eslint-plugin-lwc": "^1.1.2", to "@lwc/eslint-plugin-lwc": "^2.0.0",

iowillhoit avatar Feb 21 '25 22:02 iowillhoit

@iowillhoit Yes, that works. Now it can install correctly dependencies but I have a lot of deprecation warnings:

npm warn deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-dynamic-import instead.
npm warn deprecated @humanwhocodes/[email protected]: Use @eslint/config-array instead
npm warn deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated @humanwhocodes/[email protected]: Use @eslint/object-schema instead
npm warn deprecated [email protected]: Use your platform's native DOMException instead
npm warn deprecated [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.

Specially, there are two red flag warnings:

  • "npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful." ==> because it is a memory leak.
  • "npm warn deprecated [email protected]: This version is no longer supported. " ===> it is a no longer supported eslint version.

Thanks.

carlosabella avatar Feb 24 '25 07:02 carlosabella

Thanks @carlosabella, I will get a ticket created to look into these dependency issues. FYI, the eslint v8 issue might take a bit to resolve, we are going to need to coordinate with other teams on that one.

iowillhoit avatar Feb 25 '25 22:02 iowillhoit

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

git2gus[bot] avatar Feb 25 '25 22:02 git2gus[bot]

Thanks a lot @iowillhoit

carlosabella avatar Feb 26 '25 07:02 carlosabella

What is the recommended workaround until this is fixed? Thanks!

michi88 avatar Mar 14 '25 11:03 michi88

There are new major versions of those packages @lwc/eslint-plugin-lwc , @salesforce/eslint-config-lwc, @salesforce/eslint-plugin-lightning, and eslint that should be added to the new project template. See https://github.com/forcedotcom/cli/issues/3278 for details.

PawelWozniak avatar May 02 '25 20:05 PawelWozniak

this is fixed in sf v2.98.6 (and probably a few releases ago, we got the templates updated so now al deps are good 👍🏼 ) Image

cristiand391 avatar Jul 24 '25 14:07 cristiand391

Thank you for your effort. The issue is solved for new projects, as well upgrade of the old ones went smoothly.

PawelWozniak avatar Jul 25 '25 08:07 PawelWozniak