Page MenuHomePhabricator

npm: could not resolve codex and vue versions
Closed, ResolvedPublic

Description

This might be an npm bug or it might just require bumping some other dependency.

With this diff applied to PageTriage.git:

diff --git a/package.json b/package.json
index f882b5aa..ef9556e8 100644
--- a/package.json
+++ b/package.json
@@ -26,8 +26,8 @@
                "@wdio/local-runner": "7.19.7",
                "@wdio/mocha-framework": "7.16.6",
                "@wdio/spec-reporter": "7.19.7",
-               "@wikimedia/codex": "^0.14.0",
-               "@wikimedia/codex-icons": "^0.14.0",
+               "@wikimedia/codex": "1.3.1",
+               "@wikimedia/codex-icons": "1.3.1",
                "@wikimedia/mw-node-qunit": "^7.0.0",
                "babel-jest": "^29.6.1",
                "eslint": "^8.36.0",
@@ -36,7 +36,7 @@
                "jest": "^29.6.1",
                "jest-environment-jsdom": "^29.6.1",
                "stylelint-config-wikimedia": "0.15.0",
-               "vue": "^3.3.4",
+               "vue": "3.3.9",
                "wdio-mediawiki": "2.1.0"
        }
 }

NPM will fail with:

I have no name!@09a99f723fe9:/PageTriage$ npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: PageTriage@undefined
npm ERR! Found: @wikimedia/codex@0.14.0
npm ERR! node_modules/@wikimedia/codex
npm ERR!   dev @wikimedia/codex@"1.3.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev @wikimedia/codex@"1.3.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: vue@3.3.9
npm ERR! node_modules/vue
npm ERR!   peer vue@"3.3.9" from @wikimedia/codex@1.3.1
npm ERR!   node_modules/@wikimedia/codex
npm ERR!     dev @wikimedia/codex@"1.3.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 debug log is attached to P56333 but does not seem particularly helpful.

npm update works but we can't really run that in LibUp.

Related Objects

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

After running npm install with --legacy-peer-deps the error changes to:

I have no name!@95797c419d1f:/PageTriage$ npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @pinia/testing@0.1.2
npm ERR! Found: vue@3.3.9
npm ERR! node_modules/vue
npm ERR!   dev vue@"3.3.9" from the root project
npm ERR!   peer vue@"3.3.9" from @vue/server-renderer@3.3.9
npm ERR!   node_modules/@vue/server-renderer
npm ERR!     peerOptional @vue/server-renderer@"^3.0.1" from @vue/test-utils@2.4.0
npm ERR!     node_modules/@vue/test-utils
npm ERR!       dev @vue/test-utils@"^2.4.0" from the root project
npm ERR!     @vue/server-renderer@"3.3.9" from vue@3.3.9
npm ERR!   4 more (@vue/test-utils, @vue/vue3-jest, @wikimedia/codex, vue-demi)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer pinia@">=2.1.2" from @pinia/testing@0.1.2
npm ERR! node_modules/@pinia/testing
npm ERR!   dev @pinia/testing@"^0.1.2" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: vue@2.6.14
npm ERR! node_modules/vue
npm ERR!   peer vue@">= 2.5 < 2.7" from @vue/composition-api@1.7.2
npm ERR!   node_modules/@vue/composition-api
npm ERR!     peerOptional @vue/composition-api@"^1.4.0" from pinia@2.1.7
npm ERR!     node_modules/pinia
npm ERR!       peer pinia@">=2.1.2" from @pinia/testing@0.1.2
npm ERR!       node_modules/@pinia/testing
npm ERR!         dev @pinia/testing@"^0.1.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! 
npm ERR! For a full report see:
npm ERR! /cache/_logs/2024-02-06T19_18_43_773Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /cache/_logs/2024-02-06T19_18_43_773Z-debug-0.log

This still seems very wrong. If @vue/composition-api is an optional peer dependency of pinia, why is that being pulled in here?

It looks like the master branch of PageTriage still lists very old Codex versions in package.json:

"@wikimedia/codex": "^0.14.0",
"@wikimedia/codex-icons": "^0.14.0",

We've released Codex 1.0 and changed the version of Vue that is needed in the meantime.

What happens if you try to manually update @wikimedia/codex and @wikimedia/codex-icons to 1.3.1 or 1.3.2 (last week or week's versions)?

Change 997964 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/extensions/PageTriage@master] deps: Manually updgrade Codex, Vue, and related libs

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

Hey @taavi, I posted a patch to PageTriage that fixes this issue. I resorted to a "brute force" solution where I simply scrapped the old package-lock.json, updated the dependencies manually, and then ran npm install to re-create it. If that's not an approach that you want to take, hopefully the patch (and it's accompanying package-lock.json file) will be useful in further debugging here.

After updating Vue and Codex for this project, I found that npm run test was throwing errors; ESLint was failing to parse the Vue files. I've remedied this by adding ESLint Plugin Vue to package.json as a dev dependency as well.

I didn't run this code or inspect it deeply, so I'd recommend spinning this up in a properly-provisioned local environment; all I did was confirm that npm install and npm run test could execute without errors. Several Codex components have changed between v0.14 and v1.3.1 (you can see the full changelog here) so there may be visual changes even if no functionality you rely on has broken.

Change 997964 merged by jenkins-bot:

[mediawiki/extensions/PageTriage@master] deps: Manually upgrade Codex, Vue, and related libs

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

Hey @taavi, I posted a patch to PageTriage that fixes this issue. I resorted to a "brute force" solution where I simply scrapped the old package-lock.json, updated the dependencies manually, and then ran npm install to re-create it. If that's not an approach that you want to take, hopefully the patch (and it's accompanying package-lock.json file) will be useful in further debugging here.

After updating Vue and Codex for this project, I found that npm run test was throwing errors; ESLint was failing to parse the Vue files. I've remedied this by adding ESLint Plugin Vue to package.json as a dev dependency as well.

I didn't run this code or inspect it deeply, so I'd recommend spinning this up in a properly-provisioned local environment; all I did was confirm that npm install and npm run test could execute without errors. Several Codex components have changed between v0.14 and v1.3.1 (you can see the full changelog here) so there may be visual changes even if no functionality you rely on has broken.

I believe these packages were primarily being used for code completion. There is no discernible change.