简体   繁体   English

npm更新有效,但仍在Mac中显示旧版本

[英]npm update worked but still shows older version in mac

I wanted to update my npm version with 我想用更新我的npm版本

npm install npm@latest -g

This returns me this 这给我这个

/Users/ariful.haque/.npm-global/bin/npm -> /Users/ariful.haque/.npm-global/lib/node_modules/npm/bin/npm-cli.js
/Users/ariful.haque/.npm-global/bin/npx -> /Users/ariful.haque/.npm-global/lib/node_modules/npm/bin/npx-cli.js

But when I checked, its till on my old version. 但是,当我检查时,它一直到我的旧版本。 So, I did which npm and I get this result 所以,我做了which npm ,我得到了这个结果

/usr/local/bin/npm

If I try like 如果我尝试像

Users/ariful.haque/.npm-global/bin/npm -v

I receive correct version 6.0.1 . 我收到正确的版本6.0.1

Try adding the right location Users/ariful.haque/.npm-global/bin/npm to yourPATH, something like this: 尝试将正确的位置Users/ariful.haque/.npm-global/bin/npm到yourPATH中,如下所示:

export PATH=$PATH:/ABSOLUTE_PATH/Users/ariful.haque/.npm-global/bin

Replace ABSOLUTE_PATH with thethe rest of the path. 用其余的路径替换ABSOLUTE_PATH。 This is only work in the current terminal window, if you open other terminal window you must repeat the command. 这仅在当前终端窗口中有效,如果打开其他终端窗口,则必须重复该命令。 In case that you want to be permanent,, take a look of this link: 如果您想成为永久性的,请查看以下链接:

https://coolestguidesontheplanet.com/add-shell-path-osx/ https://coolestguidesontheplanet.com/add-shell-path-osx/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM