Page MenuHomePhabricator

Migrate all repos to lockfileVersion 2 to avoid "The package-lock.json file was created with an old version of npm"
Closed, ResolvedPublic

Description

I see this message in the npm ci step of various builds (e.g. https://integration.wikimedia.org/ci/job/quibble-vendor-mysql-php72-noselenium-docker/119033/console)

13:37:22 INFO:quibble.commands:>>> Start: npm install in /workspace/src
13:37:22 npm WARN old lockfile 
13:37:24 npm WARN old lockfile The package-lock.json file was created with an old version of npm,
13:37:24 npm WARN old lockfile so supplemental metadata must be fetched from the registry.
13:37:24 npm WARN old lockfile 
13:37:24 npm WARN old lockfile This is a one-time fix-up, please be patient...
13:37:24 npm WARN old lockfile 
13:37:24 npm WARN old lockfile wdio-mediawiki: No matching version found for wdio-mediawiki@1.2.0.
13:37:27 npm WARN old lockfile     at module.exports (/srv/npm/node_modules/npm-pick-manifest/index.js:209:23)
13:37:27 npm WARN old lockfile     at packument.then.packument (/srv/npm/node_modules/pacote/lib/registry.js:118:26)
13:37:27 npm WARN old lockfile  Could not fetch metadata for wdio-mediawiki@1.2.0 { wdio-mediawiki: No matching version found for wdio-mediawiki@1.2.0.
13:37:27 npm WARN old lockfile     at module.exports (/srv/npm/node_modules/npm-pick-manifest/index.js:209:23)
13:37:27 npm WARN old lockfile     at packument.then.packument (/srv/npm/node_modules/pacote/lib/registry.js:118:26)
13:37:27 npm WARN old lockfile   stack:
13:37:27 npm WARN old lockfile    'wdio-mediawiki: No matching version found for wdio-mediawiki@1.2.0.\n    at module.exports (/srv/npm/node_modules/npm-pick-manifest/index.js:209:23)\n    at packument.then.packument (/srv/npm/node_modules/pacote/lib/registry.js:118:26)',
13:37:27 npm WARN old lockfile   code: 'ETARGET',
13:37:27 npm WARN old lockfile   type: 'version',
13:37:27 npm WARN old lockfile   wanted: '1.2.0',
13:37:27 npm WARN old lockfile   versions:
13:37:27 npm WARN old lockfile    [ '0.1.7',
13:37:27 npm WARN old lockfile      '0.2.0',
13:37:27 npm WARN old lockfile      '0.3.0',
13:37:27 npm WARN old lockfile      '0.4.0',
13:37:27 npm WARN old lockfile      '0.5.0',
13:37:27 npm WARN old lockfile      '1.0.0',
13:37:27 npm WARN old lockfile      '1.1.0',
13:37:27 npm WARN old lockfile      '1.1.1' ],
13:37:27 npm WARN old lockfile   name: 'wdio-mediawiki',
13:37:27 npm WARN old lockfile   distTags: { latest: '1.1.1' },
13:37:27 npm WARN old lockfile   defaultTag: 'latest' }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/cli@7.4.6',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/config@7.4.2',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/dot-reporter@7.4.2',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/junit-reporter@7.4.2',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/local-runner@7.4.6',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/logger@7.4.2',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/mocha-framework@7.13.2',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/logger@7.7.0',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/types@7.13.2',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/utils@7.13.2',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/protocols@7.4.2',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/repl@7.4.6',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/reporter@7.4.2',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/runner@7.4.6',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/sync@7.4.6',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/types@7.4.2',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: '@wdio/utils@7.4.6',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: 'devtools@7.4.6',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: 'eslint-plugin-wdio@7.4.2',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: 'mocha@9.1.2',
13:37:27 npm WARN EBADENGINE   required: { node: '>= 12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: 'stylelint-no-unsupported-browser-features@5.0.1',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: 'webdriver@7.4.6',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN EBADENGINE Unsupported engine { package: 'webdriverio@7.4.6',
13:37:27 npm WARN EBADENGINE   required: { node: '>=12.0.0' },
13:37:27 npm WARN EBADENGINE   current: { node: 'v10.24.0', npm: '7.21.0' } }
13:37:27 npm WARN deprecated @stylelint/postcss-markdown@0.36.2: Use the original unforked package instead: postcss-markdown
13:37:32 npm WARN deprecated har-validator@5.1.5: this library is no longer supported
13:37:32 npm WARN deprecated formidable@1.2.2: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
13:37:32 npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
13:37:33 npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
13:37:33 
13:37:42 added 1096 packages, and audited 1098 packages in 19s
13:37:42 
13:37:42 123 packages are looking for funding
13:37:42   run `npm fund` for details
13:37:42 
13:37:42 3 moderate severity vulnerabilities
13:37:42 
13:37:42 To address all issues (including breaking changes), run:
13:37:42   npm audit fix --force
13:37:42 
13:37:42 Run `npm audit` for details.

It looks like there are two problems:

  • package-lock.json created with previous version of npm
  • some packages (wdio ones) not supported by current node engine (10, they want version 12)

Event Timeline

@hashar sorry I don't know which projects to tag this with exactly; please move around as you see fit.

I stumbled over this today as well. It seems that quibble was intentionally left out when most CI jobs were upgraded to Node12 in June: T284345#7139881. Part of the reason seems to have been that bullseye with Node12 was not available yet. Though, as I understand it, this should now be the case with T284346 being resolved.

Node12 should allow us upgrading the Browser Tests for WikibaseLexeme better and that _might_ help with very flaky daily browser test runs 🤞

It's the 5th item at T273785: Deal with release of npm 7. If you've got LibraryUpgrader active on your repo, it will always return to package-lock.json v1, no matter if you (on npm v7) have made dependency upgrades and locally have v2 that you'll commit.

Krinkle subscribed.

This does not cause a CI failure and is fully compatible. Individual project maintainers may want to update their lock file and/or LibUp needs to not downgrade, but it shouldn't be causing any issue afaik by itself, it's just warning noise.

The problem with lockfileVersion: 1 is npm 7 will revalidate all dependencies. For MobileFrontend that takes 34 seconds on my machine. Once that got upgraded to lockfileVersion: 2, npm ci no more does that whole revalidation.

On the CI builds the revalidation takes a bit of time and we redo it for any build test flow that has to run npm ci. We should migrate at least the master branches to lockfileVersion: 2 and enforce it (maybe via the job running npm test).

From @Volker_E comment above, it looks like we first need to teach LibUp to respect the currently defined lockfileVersion. Or maybe it is still using npm 6.

Change 902094 had a related patch set uploaded (by Hashar; author: Hashar):

[mediawiki/tools/api-testing@master] build: update npm lock file to version 2

https://gerrit.wikimedia.org/r/902094

Change 902094 merged by jenkins-bot:

[mediawiki/tools/api-testing@master] build: update npm lock file to version 2

https://gerrit.wikimedia.org/r/902094

Jdforrester-WMF renamed this task from The package-lock.json file was created with an old version of npm to Migrate all repos to lockfileVersion 2 to avoid "The package-lock.json file was created with an old version of npm".Mar 22 2023, 2:41 PM
Jdforrester-WMF updated the task description. (Show Details)

Change 902100 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/libs/Dodo@master] build: Re-generate package-lock.json with lockfileVersion 2

https://gerrit.wikimedia.org/r/902100

Change 902101 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/libs/WebIDL@main] build: Re-generate package-lock.json with lockfileVersion 2

https://gerrit.wikimedia.org/r/902101

Change 902105 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/services/service-scaffold-node@main] build: Drop package-lock.json, repo is broken(?)

https://gerrit.wikimedia.org/r/902105

Change 902100 merged by jenkins-bot:

[mediawiki/libs/Dodo@master] build: Re-generate package-lock.json with lockfileVersion 2

https://gerrit.wikimedia.org/r/902100

Change 902101 merged by jenkins-bot:

[mediawiki/libs/WebIDL@main] build: Re-generate package-lock.json with lockfileVersion 2

https://gerrit.wikimedia.org/r/902101

Change 902105 merged by Jforrester:

[mediawiki/services/service-scaffold-node@main] build: Drop package-lock.json, repo is broken(?)

https://gerrit.wikimedia.org/r/902105

Awesome. We certainly still have lockfile version 1 in release branches but I am willing to ignore those entirely.

Thank you for the code search link @Jdforrester-WMF :]

Change 954751 had a related patch set uploaded (by Hashar; author: Hashar):

[wikimedia-cz/tracker@master] Regenerate package-lock.json to lockfileVersion 2

https://gerrit.wikimedia.org/r/954751

Change 954751 merged by jenkins-bot:

[wikimedia-cz/tracker@master] Regenerate package-lock.json to lockfileVersion 2

https://gerrit.wikimedia.org/r/954751