【问题标题】:How do I upgrade my npm installation?如何升级我的 npm 安装?
【发布时间】:2016-01-16 05:08:04
【问题描述】:

我一直无法升级我的npm 安装。

我尝试安装新版本的npm

1.步骤

npm install npm -g

npm install npm --save-dev

2.步骤

npm outdated 

Package  Current  Wanted  Latest
npm        3.5.3   3.5.4   3.5.3

package.json

{
  "name": "tiko",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
  }
}

npm update

npm WARN EBUNDLEOVERRIDE Replacing bundled node_modules\npm\node_modules\init-pa
ckage-json with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled node_modules\npm\node_modules\npm-ins
tall-checks with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled node_modules\npm\node_modules\node-gy
p with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled node_modules\npm\node_modules\npmlog
with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled node_modules\npm\node_modules\read-pa
ckage-json with new installed version

npm outdated 

Package  Current  Wanted  Latest  Location
npm        3.5.4   3.5.4   3.5.3  tiko

npm 更新不起作用吗?

【问题讨论】:

  • 最新版本是3.5.3。这意味着您还不能升级到更新的版本。
  • @gnerkus 为什么“通缉= 3.5.4”?
  • 这是“边缘”版本。它不是稳定的,但它是可用的。见:stackoverflow.com/questions/32689865/npm-wanted-vs-latest
  • @gnerkus -我正在尝试本地安装。为什么应该是全球性的? - WARN 首选全局 npm@3.5.3 应该安装 -g
  • 本地包被限制在一个项目中;全局包可以在任何项目中使用。 npm 是一个包,它也是一个包管理器,因此它需要在全球范围内可用。

标签: node.js npm npm-install


【解决方案1】:

您可以使用npm 本身更新您的npm 安装。

您需要将最新版本的npm 安装为全局包:

$ npm install npm -g

【讨论】:

  • 我在尝试,但没有更新。 npm 3.5.3 3.5.4 3.5.3
  • 你有package.json 文件吗?
  • gnerkus,是的。需要你看吗?
  • 你能把它添加到你的问题中吗?
  • 有时,npm update 命令不会更新npm 版本。我已经编辑了答案。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-04-25
  • 1970-01-01
  • 2014-08-21
  • 2012-01-07
  • 2021-04-11
  • 1970-01-01
  • 2018-10-24
相关资源
最近更新 更多