gpt4 book ai didi

node.js - npm 过时的全局包 : How to actually update a package?

转载 作者:行者123 更新时间:2023-12-02 04:36:29 25 4
gpt4 key购买 nike

❯ npm outdated -g
Package Current Wanted Latest Location
eslint 3.11.1 3.11.1 3.15.0
eslint-plugin-react 3.0.0 6.9.0 6.9.0
flow-bin 0.35.0 0.39.0 0.39.0
grunt-cli 0.1.13 1.2.0 1.2.0
gulp 3.9.0 3.9.1 3.9.1
jshint 2.8.0 2.9.4 2.9.4
npm 3.8.6 4.3.0 4.2.0
uglify-js 2.7.0 2.7.5 2.7.5

想知道为什么我的 eslint 不会更新。 npm upgrade -g -dd eslint给我看
npm verb outdated not updating eslint because it's currently at the maximum version that matches its specified semver range

这让我尝试了 outdated ,但无论哪种方式,全局 package.json不是存在的东西。那么为什么我仅限于 3.11 呢??

根据 npmjs 文档,

If there's no available semver range (i.e. you're running npm outdated --global, or the package isn't included in package.json), then wanted shows the currently-installed version.



这根本没有任何意义。

最佳答案

将全局包更新到“最新”版本 :

npx npm-check --global --update
这会将全局包更新到“最新”版本*。 More information is available about npm-check ,包括无需提示即可更新、排除软件包等功能。

相反, npm update -g仅将全局包更新为 npm outdated --global 显示的“Wanted”版本, 因为全局安装的包被视为安装在指定的插入符号范围内。

最后,如果您碰巧想将软件包更新(安装)到“最新”或“想要”以外的版本: npm install --global <pkg>@<version>

关于node.js - npm 过时的全局包 : How to actually update a package?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42196870/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com