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 eslint dependency #5953

Open
megasmack opened this issue Nov 19, 2024 · 7 comments
Open

npm install is failing due eslint dependency #5953

megasmack opened this issue Nov 19, 2024 · 7 comments

Comments

@megasmack
Copy link

megasmack commented Nov 19, 2024

Summary

After creating a project using the VSCode Extension, I get an error when running npm install.

Steps To Reproduce:

  1. Create a new project using the VSCode Extension.
  2. Run npm install.

Expected result

npm should install all dependencies for the project

Actual result

I get the following error:

$ npm install
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: [email protected]
npm error Found: [email protected]
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/[email protected]
npm error   node_modules/@babel/eslint-parser
npm error     peer @babel/eslint-parser@"^7" from @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 eslint@"^7 || ^8" from @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 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/steveschrab/.npm/_logs/2024-11-19T15_07_57_992Z-eresolve-report.txt

Additional information

Salesforce Extension Version in VS Code: 62.5.1
Salesforce CLI Version: @salesforce/cli/2.66.7 darwin-arm64 node-v22.11.0
OS and version: MacOS Sequoia 15.0.1 14.5
VS Code version: 1.95.3
Most recent version of the extensions where this was working: No idea.

We looked into this issue on the CLI repo where it looks like it's an issue in the extension versus the CLI. forcedotcom/cli#3098

The main thing I spotted was that creating a project directly through the sf cli creates a package.json using "eslint": "^8.57.0" while VSCode plugin generates a package.json using "eslint": "^9.9.1". This looks like it's conflicting with the eslint-plugin-lwc package that requires "eslint": "^8.57.0".

@svc-idee-bot
Copy link
Collaborator

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.

@svc-idee-bot
Copy link
Collaborator

Hello @megasmack 👋 It looks like you didn't provide all the required basic info in your issue.

If you haven't already, please provide the following info:
Salesforce Extension Version in VS Code:
Salesforce CLI Version:
OS and version:
VS Code version:
Most recent version of the extensions where this was working:

Here's an example of a set of required info that will pass the validation:
Salesforce Extension Version in VS Code: 60.13.0
Salesforce CLI Version: @salesforce/cli/2.42.6 darwin-arm64 node-v18.18.2
OS and version: MacOS Sonoma 14.5
VS Code version: 1.89.1
Most recent version of the extensions where this was working: 60.11.0

A few more things to check:

  • Make sure you've provided detailed steps to reproduce your issue, as well as all error messages that you see.
    • A repository that clearly demonstrates the bug is ideal.
    • Error messages can be found in the Problems Tab, Output Tab, and from running Developer: Toggle Developer Tools in the command palette.
  • Make sure you've installed the latest version of the Salesforce Extension Pack for VSCode. (docs)
  • Search GitHub for existing related issues.

Thank you!

Copy link

git2gus bot commented Nov 19, 2024

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

@peternhale
Copy link
Contributor

@megasmack I have conformed the error you are seeing in the generated project and have logged a bug.

The workaround is to change eslint to version 8.57.0 and change script postinstall to "husky init"

@tenacoder
Copy link

Once it is installed how do we remove it. I have disabled the extension. I don't know how it help to fix something in postinstall once it has been installed?

@megasmack
Copy link
Author

@tenacoder After updating the package.json with the workaround, I just deleted my node_modules directory and my package-lock.json file and re-ran npm install.

@CristiCanizales
Copy link
Contributor

@tenacoder Hi, Peter meant to modify the postinstall script in the package.json of your sf project.
image

You didn't need to disable the extension, that has no effect in running npm install in a project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants