node.js 如何安装新版本的 NPM ( 1.1.24 )?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10927490/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 15:50:20  来源:igfitidea点击:

How can install a new version of NPM ( 1.1.24 )?

node.jsnpm

提问by captainill

I want to install the latest stable version of node - Version 0.6.19 (stable).

我想安装最新的稳定版节点 - 版本 0.6.19(稳定版)。

http://blog.nodejs.org/indicates to upgrade to NPM to 1.1.24

http://blog.nodejs.org/表示升级到 NPM 到 1.1.24

Is there a simple way to upgrade to this? I can't figure out how exactly to download and target this version.

有没有简单的方法可以升级到这个?我无法弄清楚如何准确下载和定位此版本。

The below gives me npm -v 1.0.106

下面给了我 npm -v 1.0.106

npm upgrade npm

or

或者

npm upgrade npm 1.1.24

回答by Dhiraj

Update 2 (03/11/15)

更新 2 (03/11/15)

Courtesy: whyleee

礼貌:whylee

On Windows npm is installed together with node in "Program Files". Use npm install npm -g to install it in "%AppData%\npm" and delete 'npm', 'npm.cmd' files from "C:\Program Files\nodejs" dir (because your PATH is looking there first). After that you can use npm update npm -g in the future

在 Windows 上,npm 与节点一起安装在“程序文件”中。使用 npm install npm -g 将其安装在“%AppData%\npm”中,并从“C:\Program Files\nodejs”目录中删除“npm”、“npm.cmd”文件(因为你的 PATH 首先在那里查找)。之后你可以在未来使用 npm update npm -g



According to the docs

根据文档

For windows(it also worked on Mac for me)

For windows(它也适用于我的 Mac)

To update npm, run the npm update npm -gcommand.

要更新 npm,请运行npm update npm -g命令。

Also verify this

也验证这个

Hope this helps

希望这可以帮助

回答by Igor

The only thing that worked for me was (from npm readme)

唯一对我有用的是(来自 npm readme)

Fancy Windows Install

You can download a zip file from https://npmjs.org/dist/, and unpack it in the same folder where node.exe lives.

花式 Windows 安装

您可以从https://npmjs.org/dist/下载一个 zip 文件,然后将其解压到 node.exe 所在的文件夹中。

In my case folder is :

在我的情况下文件夹是:

C:\Program Files (x86)\nodejs

C:\Program Files (x86)\nodejs

Edit: It seams that newer versions of npm does not exist on address I wrote. I will copy paste instructions from npm git page

编辑:看来我写的地址上不存在较新版本的 npm。我将从 npm git 页面复制粘贴说明

You can download a zip file from https://npmjs.org/dist/, and unpack it in the same folder where node.exe lives.

The latest version in a zip file is 1.4.12. To upgrade to npm 2, follow the Windows upgrade instructions in the npm Troubleshooting Guide:

https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows

If that's not fancy enough for you, then you can fetch the code with git, and mess with it directly.

您可以从https://npmjs.org/dist/下载一个 zip 文件,然后将其解压到 node.exe 所在的文件夹中。

zip 文件中的最新版本是 1.4.12。要升级到 npm 2,请按照 npm 故障排除指南中的 Windows 升级说明进行操作:

https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows

如果这对您来说还不够花哨,那么您可以使用 git 获取代码,然后直接使用它。

回答by Prathik Rajendran M

In ubuntu you can upgrade it using

在 ubuntu 中,您可以使用

sudo npm update npm -g

回答by Sai

In windows, to install latest version of npm

在 windows 中,安装最新版本的 npm

npm install npm@latest -g

npm 安装 npm@latest -g

&

&

In ubuntu you can use

在 ubuntu 中,您可以使用

sudo npm install npm@latest -g

须藤 npm 安装 npm@latest -g

*note: the latest version till sept 12 2016 is (The current stable version of npm is) 3.10.7

*注:截至 2016 年 9 月 12 日的最新版本是(npm 的当前稳定版本是)3.10.7

check version by running on command prompt

通过在命令提示符下运行来检查版本

npm -v

npm -v

回答by Fortin

https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows

https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows

Option 3: navigate to C:\Program Files (x86)\nodejs with cmd.exe and then run the installation without -g:

选项 3:使用 cmd.exe 导航到 C:\Program Files (x86)\nodejs,然后不带 -g 运行安装:

This sovled it for me.

这为我解决了。