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

Migrate package-lock.json file to version 2 #129

Closed
smoya opened this issue Oct 11, 2022 · 14 comments · Fixed by #134
Closed

Migrate package-lock.json file to version 2 #129

smoya opened this issue Oct 11, 2022 · 14 comments · Fixed by #134

Comments

@smoya
Copy link
Member

smoya commented Oct 11, 2022

Reason/Context

Parser-JS requires now Node.js 14 and npm7 or higher.
This means package-lock.json version should be always set to 2.

Description

In order to unify development requirements, I suggest all repositories to stick with that requirements. In order to do that, the following is needed:

  • Clarify this requirement under Development section on this repository README file.
  • To update package-lock.json to version 2. This is automatically done when running npm install if the npm version used is 7 or higher.

Related:

@github-actions
Copy link

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@ivangsa
Copy link
Collaborator

ivangsa commented Oct 13, 2022

Hi @smoya

I'm looking into this but my node 14 from nvm comes with npm 6 and npm i -g npm refuses to overwrite current version...
so I will need an spare moment to get it done

@smoya
Copy link
Member Author

smoya commented Oct 13, 2022

Hi @smoya

I'm looking into this but my node 14 from nvm comes with npm 6 and npm i -g npm refuses to overwrite current version... so I will need an spare moment to get it done

I recommend you installing and using NVM; using a newer version like 16 will be as easy as:

nvm install 16
nvm use 16

Then you can run npm install on your project and the package-lock.json will be converted to version 2.
You can come back to 14 by following the same commands replacing 16 by 14.

@ivangsa
Copy link
Collaborator

ivangsa commented Oct 13, 2022

after upgrading npm I'm getting this error...

the weird thing is that I could delete package-lock.json and regenerate it to v2, but I don't know why I'm getting this error now...

maybe is just upgrade @semantic-release/commit-analyzer@

$ npm --version
8.19.2

ivan.garcia@H00HCK3 MINGW64 ~/workspace/zenwave/asyncapi-preview (feature/content-assistance)
$ npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @semantic-release/commit-analyzer@8.0.1
npm ERR! Found: semantic-release@19.0.3
npm ERR! node_modules/semantic-release
npm ERR!   dev semantic-release@"19.0.3" from the root project
npm ERR!   peer semantic-release@">=19.0.0" from @semantic-release/npm@9.0.1
npm ERR!   node_modules/@semantic-release/npm
npm ERR!     @semantic-release/npm@"^9.0.0" from semantic-release@19.0.3
npm ERR!   3 more (@semantic-release/commit-analyzer, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer semantic-release@">=16.0.0 <18.0.0" from @semantic-release/commit-analyzer@8.0.1
npm ERR! node_modules/@semantic-release/commit-analyzer
npm ERR!   dev @semantic-release/commit-analyzer@"^8.0.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: semantic-release@17.4.7
npm ERR! node_modules/semantic-release
npm ERR!   peer semantic-release@">=16.0.0 <18.0.0" from @semantic-release/commit-analyzer@8.0.1
npm ERR!   node_modules/@semantic-release/commit-analyzer
npm ERR!     dev @semantic-release/commit-analyzer@"^8.0.1" 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 C:\Users\ivan.garcia\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ivan.garcia\AppData\Local\npm-cache\_logs\2022-10-13T19_25_41_552Z-debug-0.log

@smoya
Copy link
Member Author

smoya commented Oct 17, 2022

after upgrading npm I'm getting this error...

Thats weird. I just ran the command and it worked:

❯ npm -v
8.1.2
❯ npm i
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.

added 650 packages, and audited 851 packages in 13s

86 packages are looking for funding
  run `npm fund` for details

1 high severity vulnerability

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

I opened a PR in fact: #134

@ivangsa
Copy link
Collaborator

ivangsa commented Oct 17, 2022

This is weirder, because I can also create a new package-lock.json file, but I can not npm i when the lock file was upgraded...

ivan.garcia@H00HCK3 MSYS ~/workspace/zenwave/asyncapi-preview (feature/content-assistance)
$ npm i
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile

up to date, audited 852 packages in 9s

86 packages are looking for funding
  run `npm fund` for details

1 high severity vulnerability

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

ivan.garcia@H00HCK3 MSYS ~/workspace/zenwave/asyncapi-preview (feature/content-assistance)
$ npm i
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @semantic-release/commit-analyzer@8.0.1
npm ERR! Found: semantic-release@19.0.3
npm ERR! node_modules/semantic-release
npm ERR!   dev semantic-release@"19.0.3" from the root project
npm ERR!   peer semantic-release@">=19.0.0" from @semantic-release/npm@9.0.1
npm ERR!   node_modules/@semantic-release/npm
npm ERR!     @semantic-release/npm@"^9.0.0" from semantic-release@19.0.3
npm ERR!   3 more (@semantic-release/commit-analyzer, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer semantic-release@">=16.0.0 <18.0.0" from @semantic-release/commit-analyzer@8.0.1
npm ERR! node_modules/@semantic-release/commit-analyzer
npm ERR!   dev @semantic-release/commit-analyzer@"^8.0.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: semantic-release@17.4.7
npm ERR! node_modules/semantic-release
npm ERR!   peer semantic-release@">=16.0.0 <18.0.0" from @semantic-release/commit-analyzer@8.0.1
npm ERR!   node_modules/@semantic-release/commit-analyzer
npm ERR!     dev @semantic-release/commit-analyzer@"^8.0.1" 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 C:\Users\ivan.garcia\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ivan.garcia\AppData\Local\npm-cache\_logs\2022-10-17T15_50_59_536Z-debug-0.log

ivan.garcia@H00HCK3 MSYS ~/workspace/zenwave/asyncapi-preview (feature/content-assistance)
$ npm --version
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
8.11.0

@smoya
Copy link
Member Author

smoya commented Oct 17, 2022

Did you try removing your node_modules directory before npm i? Just in case...

@ivangsa
Copy link
Collaborator

ivangsa commented Oct 17, 2022

Yes, I just did...

It works if I add --legacy-peer-deps but not otherwise and I tried three different versions: with npm from nvm, npm i -g npm and npm downloaded from zip distribution...

It works for you the second time you run npm i?

@smoya
Copy link
Member Author

smoya commented Oct 17, 2022

It works for you the second time you run npm i?

Yes it does. However, trying with the same version of npm as you (8.11.0), it fails:

❯ npm -v
8.11.0
~/dev/vs-asyncapi-preview master                                                                                                                                                                                   6s 18:56:58
❯ npm i
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.

added 650 packages, and audited 851 packages in 9s

86 packages are looking for funding
  run `npm fund` for details

1 high severity vulnerability

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
~/dev/vs-asyncapi-preview master !1                                                                                                                                                                                9s 18:57:14
❯ npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @semantic-release/commit-analyzer@8.0.1
npm ERR! Found: semantic-release@19.0.3
npm ERR! node_modules/semantic-release
npm ERR!   dev semantic-release@"19.0.3" from the root project
npm ERR!   peer semantic-release@">=19.0.0" from @semantic-release/npm@9.0.1
npm ERR!   node_modules/@semantic-release/npm
npm ERR!     @semantic-release/npm@"^9.0.0" from semantic-release@19.0.3
npm ERR!   3 more (@semantic-release/commit-analyzer, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer semantic-release@">=16.0.0 <18.0.0" from @semantic-release/commit-analyzer@8.0.1
npm ERR! node_modules/@semantic-release/commit-analyzer
npm ERR!   dev @semantic-release/commit-analyzer@"^8.0.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: semantic-release@17.4.7
npm ERR! node_modules/semantic-release
npm ERR!   peer semantic-release@">=16.0.0 <18.0.0" from @semantic-release/commit-analyzer@8.0.1
npm ERR!   node_modules/@semantic-release/commit-analyzer
npm ERR!     dev @semantic-release/commit-analyzer@"^8.0.1" 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 /Users/smoya/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/smoya/.npm/_logs/2022-10-17T16_57_20_962Z-debug-0.log

@ivangsa
Copy link
Collaborator

ivangsa commented Oct 17, 2022

I tried with different versions as well:

$ ~/workspace/bin/node-v16.18.0-win-x64/npm i --version
8.19.2

@ivangsa
Copy link
Collaborator

ivangsa commented Oct 17, 2022

I'm starting thinking that the problem is with the semantic-release dependency..

@smoya
Copy link
Member Author

smoya commented Oct 17, 2022

I'm starting thinking that the problem is with the semantic-release dependency..

I did upgrade some related packages and indeed, the issue seems to be fixed: https://github.com/asyncapi/vs-asyncapi-preview/pull/134/files

@ivangsa
Copy link
Collaborator

ivangsa commented Oct 17, 2022

thanks for your help @smoya
I'll wait for @derberg if he wants to review the PR as well..

@derberg
Copy link
Member

derberg commented Oct 18, 2022

all good from my side

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