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

Fix GitHub CI npm install by using --legacy-peer-deps #751

Merged
merged 1 commit into from
Jun 20, 2022

Conversation

nksazonov
Copy link
Contributor

#676 introduces a GitHub Actions issue related to peer-deps:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @nomiclabs/[email protected]
npm ERR! Found: @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   dev @nomiclabs/hardhat-ethers@"npm:hardhat-deploy-ethers@^0.3.0-beta.13" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @nomiclabs/hardhat-ethers@"^2.0.0" from @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-waffle
npm ERR!   dev @nomiclabs/hardhat-waffle@"^2.0.2" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @nomiclabs/[email protected].[6](https://github.com/statechannels/go-nitro/runs/6967242499?check_suite_focus=true#step:4:7)
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   peer @nomiclabs/hardhat-ethers@"^2.0.0" from @nomiclabs/[email protected]
npm ERR!   node_modules/@nomiclabs/hardhat-waffle
npm ERR!     dev @nomiclabs/hardhat-waffle@"^2.0.2" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /home/runner/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2022-06-20T12_54_01_03[8](https://github.com/statechannels/go-nitro/runs/6967242499?check_suite_focus=true#step:4:9)Z-debug-0.log

This issue is caused by an npm-alias created for @nomiclabs/hardhat-ethers hiding hardhat-deploy-ethers.

As of time of creating this PR, there seems to be no general solution to this issue.

Thus, it was decided to bypass the problem by using --legacy-peer-deps flag (good post about it here).

Also npm ci is used instead of npm i to make a clean install of dependencies (copied from npm help ci):

In short, the main differences between using npm install and npm ci are:

  • The project must have an existing package-lock.json or npm-shrinkwrap.json.

  • If dependencies in the package lock do not match those in package.json, npm ci will exit with an error, instead of updating the package lock.

  • npm ci can only install entire projects at a time: individual dependencies cannot be added with this command.

  • If a node_modules is already present, it will be automatically removed before npm ci begins its install.

Nevertheless, --legacy-peer-deps is not a cure and an issue to fix peer-deps and return to pure npm ci is to be created.

@nksazonov nksazonov requested a review from geoknee June 20, 2022 13:25
Copy link
Contributor

@geoknee geoknee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed write up!

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

Successfully merging this pull request may close these issues.

2 participants