npm install npm -g 不会将 npm 更新到最新版本 [英] npm install npm -g won't update npm to the latest version

查看:53
本文介绍了npm install npm -g 不会将 npm 更新到最新版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 npm v5.3.0.现在我想将 npm 更新到 v5.4.1.为此,我在终端中键入以下内容:

I am using npm v5.3.0. Now I want to update npm to v5.4.1.To do this I type the following in my terminal:

npm install -g npm

没有任何错误.但是当我输入 npm -v 时,我得到的版本是 5.3.0 而不是 5.4.1

without any errors.However when I type npm -v the version I get is the 5.3.0 not the 5.4.1

不得不提的是,我已经将 npm 前缀更改为另一个目录.有任何想法吗?我使用 Ubuntu 17.04

I have to mention that I have changed the npm prefix to another directory. Any ideas? I use Ubuntu 17.04

这是我的控制台输出:

推荐答案

问题是我在 ~/.profile 中设置了 PATH 变量错误.为了帮助您理解.我已将 npm 前缀更改为 ~/.npm-global

The problem was that I has set the PATH variable in my ~/.profile wrong. To help you understand.I had changed npm prefix to ~/.npm-global

但是我将路径设置为 ~/npm-global.所以我将 ~/.profile 中的 PATH 变量固定为指向 ~/.npm-global.

However I set path to ~/npm-global.So I fixed the PATH variable in my ~/.profile to point to ~/.npm-global instead.

这篇关于npm install npm -g 不会将 npm 更新到最新版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆