简体   繁体   中英

npm update worked but still shows older version in mac

I wanted to update my npm version with

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

/usr/local/bin/npm

If I try like

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

I receive correct version 6.0.1 .

Try adding the right location Users/ariful.haque/.npm-global/bin/npm to yourPATH, something like this:

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

Replace ABSOLUTE_PATH with thethe rest of the 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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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