1

I'm on MacBook Air HighSierra v10.13.4.

I installed node from https://nodejs.org/ and it gave me npm@5.6.0. I want to upgrade npm to the current lastest version.

So I've tired npm i npm@latest -g , npm i npm -g and sudo npm i npm -g. It returns

/Users/sandeep/.npm-global/bin/npm -> /Users/sandeep/.npm-global/lib/node_modules/npm/bin/npm-cli.js
/Users/sandeep/.npm-global/bin/npx -> /Users/sandeep/.npm-global/lib/node_modules/npm/bin/npx-cli.js
+ npm@6.4.0
updated 1 package in 12.452s

But no good when I run npm -v it returns me 5.6.0.

But when i run npm list --depth=0 -g it shows npm@6.4.0.

Can someone pls help me with this ?

Sandeep Ranjan
  • 824
  • 15
  • 33

2 Answers2

2

You can upgrade to the latest version of npm using:

npm install -g npm@latest

Or upgrade to the most recent release:

npm install -g npm@next

You may need to prefix these commands with sudo, especially on Linux, or OS X if you installed Node using its default installer.

Ramesh
  • 2,297
  • 2
  • 20
  • 42
2

I will suggest you download macOS Installer node-v8.11.4.pkg and use your installer to install it.

Node: On default Latest LTS Version: 8.11.4 (includes npm 5.6.0)

After you install the default 8.11.4, run:

npm install -g npm

This should update you to the most recent version of npm.

I hope this helps.

antzshrek
  • 9,276
  • 5
  • 26
  • 43