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

does not work with npm@7 #312

Open
chadoh opened this issue Nov 27, 2020 · 3 comments
Open

does not work with npm@7 #312

chadoh opened this issue Nov 27, 2020 · 3 comments
Assignees
Labels
bug Something isn't working T-dev-tools

Comments

@chadoh
Copy link
Contributor

chadoh commented Nov 27, 2020

NodeJS 15 ships with [NPM 7](https://blog.npmjs.org/post/617484925547986944/npm-v7-series-introduction). Perhaps the biggest change in NPM 7 is that it automatically installs peerDependencies. If peerDependencies are well-specified this causes no issues, but it seems that the peerDependencies within the near-sdk-as packages are not quite correct.

on 'master' branch of 'near-sdk-as', running the command 'rm -rf node_modules package-lock.json yarn.lock && npm i' results in errors 'ERESOLVE unable to resolve dependency tree'

    1. To Reproduce
      As shown in the screenshot above:

1. install nodejs 15, which comes with npm 7
2. check out the latest master branch of near-sdk-as
3. remove yarn.lock and node_modules
4. run npm install

This is the fastest way to reproduce this issue, but note that the issue also arises for projects that depend on near-sdk-as. See the same error as shown in the screenshot above in the output from a fresh project created with create-near-app here: near/create-near-app#533

I've worked around the problem in create-near-app by adding npm install --legacy-peer-deps to the command: near/create-near-app@38020ab

Once we address the bug here in near-sdk-as, we can get rid of this flag.

@chadoh chadoh added the bug Something isn't working label Nov 27, 2020
@chadoh
Copy link
Contributor Author

chadoh commented Nov 28, 2020

@willemneal this might be nice and fast for you. If not, I could spend a couple hours trying to figure it out sometime in the next two week or so.

chadoh added a commit to near/create-near-app that referenced this issue Nov 28, 2020
fixes #533

npm@7 ships with node@15 and changes behavior to automatically install
peerDependencies. It seems that the peerDependencies for near-sdk-as
aren't configured perfectly, and this causes problems. Once we figure
out this upstream problem, we may also need to add more explicit
dependencies at the root of the project, since npm@7 may not install
dependencies-of-dependencies to the root node_modules folder, either.

This will be addressed in near/near-sdk-as#312

https://blog.npmjs.org/post/626173315965468672/npm-v7-series-beta-release-and-semver-major
chadoh added a commit to near/create-near-app that referenced this issue Nov 28, 2020
fixes #533

npm@7 ships with node@15 and changes behavior to automatically install
peerDependencies. It seems that the peerDependencies for near-sdk-as
aren't configured perfectly, and this causes problems. Once we figure
out this upstream problem, we may also need to add more explicit
dependencies at the root of the project, since npm@7 may not install
dependencies-of-dependencies to the root node_modules folder, either.

This will be addressed in near/near-sdk-as#312

https://blog.npmjs.org/post/626173315965468672/npm-v7-series-beta-release-and-semver-major
@willemneal
Copy link
Contributor

@chadoh Not sure how I missed this. I guess I need to cultivate my GH notifications. @amgando noticed this a while back and the solution was to just roll it back. Perhaps the quick solution is to add to the node requirements in the package.json so that it fails to install if 15 is used.

Not the best long term solution. I think the issue here is that the tooling, e.i. as-pect only supports up to a certain version of AS (currently working on updating to the newest one and should be done by end of day) and so the peer dep are there to signal that it claims to only support that version. However, even with no updates to as-pect the newer versions of AS worked. We should have updated the project and its peer dep, but it still sucks that this would cause things to fail.

I also think another reason to switch to GH Actions is that we could make one action that tests all versions of node. Then all the other projects depend on it. Then when we want to update the action to include a new version of node it updates the rest.

@chadoh
Copy link
Contributor Author

chadoh commented Dec 4, 2020

Looks like as-pect@2.0.0 has been published. Is this the version that was needed in order to straighten out the dependencies of near-sdk-as?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working T-dev-tools
Projects
None yet
Development

No branches or pull requests

2 participants