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

[BUG] npm update global not updating packages to latest #746

Closed
johnkennedy9147 opened this issue Jan 30, 2020 · 4 comments
Closed

[BUG] npm update global not updating packages to latest #746

johnkennedy9147 opened this issue Jan 30, 2020 · 4 comments
Labels
Bug thing that needs fixing

Comments

@johnkennedy9147
Copy link
Contributor

Attempting to update all globally installed packages docs state should go to latest but this does not happen. Possibly updating as if applying semver ^ range.

npm outdated shows:

Package Current Wanted Latest Location
eslint 5.16.0 5.16.0 6.8.0 global
gatsby-cli 2.8.21 2.8.28 2.8.28 global
lighthouse 4.3.0 4.3.1 5.6.0 global
prettier 1.18.2 1.19.1 1.19.1 global
rimraf 2.6.3 2.7.1 3.0.1 global
yarn 1.15.2 1.21.1 1.21.1 global

ran npm update

npm outdated now shows

Package Current Wanted Latest Location
eslint 5.16.0 5.16.0 6.8.0 global
lighthouse 4.3.1 4.3.1 5.6.0 global

Expectation was that both would have been updated to latest.
eslint not updated.
lighthouse only updated to highest V4 version published (consistent with semver ^)

@ljharb
Copy link
Contributor

ljharb commented Jan 31, 2020

They update to “wanted”, not “latest”. Global packages have an implicit ^ semver range, i believe.

@johnkennedy9147
Copy link
Contributor Author

That appears to be the case but the docs state they should go to latest, so either docs need updated or this is a defect.

image

@johnkennedy9147
Copy link
Contributor Author

verbose logging revealed that it is indeed deliberate

npm verb outdated not updating rimraf because it's currently at the maximum version that matches its specified semver range

and found the decision point in the code

cli/lib/update.js

Lines 42 to 48 in f533d61

if (ww.current === ww.wanted && ww.wanted !== ww.latest) {
log.verbose(
'outdated',
'not updating', ww.depname,
"because it's currently at the maximum version that matches its specified semver range"
)
}

@darcyclarke
Copy link
Contributor

npm v6 is no longer in active development; We will continue to push security releases to v6 at our team's discretion as-per our Support Policy.

If your bug is preproducible on v7, please re-file this issue using our new issue template.

If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo

Closing: This is an automated message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants