【问题标题】:npm outdated and npm update doesn't worknpm 过时并且 npm update 不起作用
【发布时间】:2013-12-22 02:02:04
【问题描述】:

我想检查我的模块是否是最新的

我愿意:sudo npm outdated

我有这个结果

Package              Current  Wanted  Latest  Location

oauth                  0.9.9   0.9.9  0.9.10  twit > oauth
require-all            0.0.3   0.0.3   0.0.8  mysql > require-all
bignumber.js           1.0.1   1.0.1   1.3.0  mysql > bignumber.js
request               2.27.0  2.27.0  2.30.0  facebook-chat > node-xmpp > node-xmpp-client > request
through                2.2.7   2.2.7   2.3.4  facebook-chat > node-xmpp > brfs > through

然后我这样做:sudo npm update 但是如果我重复sudo npm outdated 我会得到相同的结果... 例如,如果我这样做 信息:

Package              Current  Wanted  Latest  Location
oauth                  0.9.9   0.9.9  0.9.10  twit > oauth

然后更新

sudo npm update oauth

然后

sudo npm outdated oauth

我的结果:

Package  Current  Wanted  Latest  Location
oauth      0.9.9   0.9.9  0.9.10  twit > oauth

【问题讨论】:

  • 您是否将特定的包版本放入您的package.json 文件中(例如~0.11.8 而不是*)?如果依赖关系太严格,我怀疑 NPM 会更新你的包。
  • 不,我没有编辑文件..

标签: node.js


【解决方案1】:

您的项目实际上是最新的。

NPM 不会简单地安装包的Latest 版本,除非that version is also Wanted

结果字段 'wanted' 根据 package.json 中指定的版本显示最新版本,[...]

而且,对于您列出的每个,WantedCurrent 版本已经匹配。

Package              Current  Wanted ...

oauth                  0.9.9   0.9.9 ...
require-all            0.0.3   0.0.3 ...
bignumber.js           1.0.1   1.0.1 ...
request               2.27.0  2.27.0 ...
through                2.2.7   2.2.7 ...

例如,尝试将oauth 强制为0.9.10 的当前Latest,实际上会将invalid 视为twit has 0.9.9 listed exactly

"dependencies": {
  "oauth": "0.9.9"
},
$ npm ls
...
└─┬ twit@1.1.11
  └── oauth@0.9.10 invalid

npm ERR! invalid: oauth@0.9.10 ...\node_modules\twit\node_modules\oauth

【讨论】:

  • 感谢您的回复! twit 使用 oauth 0.9.9,但是这种依赖是在 0.9.10 版本上,直到 Twit 不需要它才更新.. 强制 oauth 到 0.9.10 版本可能会导致错误...这是你的意思吗?跨度>
  • @Barno 是的。 twit 必须更新其"dependencies" 以允许在其下安装oauth@0.9.10。不过,由于 twit 是一个开源项目,如果所有测试仍然通过,作者可能会受到更新的拉取请求。
  • 我从不将 sudo 与 npm 一起使用,应该这样吗?
【解决方案2】:

检查你的 package.json 可能是你的包或者那里。 尝试使用 --save 安装包并尝试它会工作

示例: npm install underscore@1.5.0 --save 现在试试 npm 过时了

【讨论】:

    猜你喜欢
    • 2023-03-23
    • 2018-04-17
    • 2016-05-03
    • 1970-01-01
    • 1970-01-01
    • 2018-01-28
    • 1970-01-01
    • 2019-10-08
    • 2018-01-03
    相关资源
    最近更新 更多