Skip to content

fix: handles possible NpmDetails array (W-24124675) - #918

Merged
k80bowman merged 1 commit into
mainfrom
jf/W-24124675
Sep 8, 2026
Merged

fix: handles possible NpmDetails array (W-24124675)#918
k80bowman merged 1 commit into
mainfrom
jf/W-24124675

Conversation

@jfeingold35

Copy link
Copy Markdown
Contributor

@W-24124675@

Closes #917

Explanation: In NPM v12, npm view has been changed to always return an array. As such, one method in version.ts had to be changed to handle the possibility of receiving an array from npm view.

Test coverage is absent due to the difficulty of testing a problem that is dependent on an npm view result returned by a child process, but manual testing was performed.

TO VALIDATE FIX:

sf plugins uninstall @oclif/plugin-version // make sure you're using the production plugin

npm install --global npm@latest // v12.0.1 at time of writing
sf version --verbose // Observe error

npm install --global npm@11.19.1 // latest v11 release
sf version --verbose // observe success

git checkout [this branch]
yarn && yarn build
sf plugins link . // Use the fixed plugin
npm install --global npm@latest
sf version --verbose // observe success
npm install --global npm@11.19.1
sf version --verbose // observe success

@k80bowman
k80bowman merged commit e3b2ddf into main Sep 8, 2026
10 checks passed
@k80bowman
k80bowman deleted the jf/W-24124675 branch September 8, 2026 18:39
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.

"Cannot read properties of undefined" error caused by npm v12

2 participants