[SOLVED] Upgrading from 6.9.0 to 6.10.0 doesn't take effect

What I Wanted to Do

I’m using npm 6.9.0 with node 12.4.0 on Ubuntu 18.04 64bits.
When receiving the update notice of 6.10.0, I run npm install -g npm and it informs that the new version was installed:

/home/myuser/.npm-global/bin/npm -> /home/myuser/.npm-global/lib/node_modules/npm/bin/npm-cli.js
/home/myuser/.npm-global/bin/npx -> /home/myuser/.npm-global/lib/node_modules/npm/bin/npx-cli.js
+ npm@6.10.0
updated 1 package in 4.223s

What Happened Instead

But, after that, if I run npm -v, I still get 6.9.0

I checked all the permissions and everything is ok.

Details

Platform Info

$ npm --versions
{
  npm: '6.9.0',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '35.1',
  http_parser: '2.8.0',
  icu: '64.2',
  llhttp: '1.1.3',
  modules: '72',
  napi: '4',
  nghttp2: '1.38.0',
  node: '12.4.0',
  openssl: '1.1.1b',
  tz: '2019a',
  unicode: '12.1',
  uv: '1.29.1',
  v8: '7.4.288.27-node.18',
  zlib: '1.2.11'
}
$ node -p process.platform
linux

You are installing to a custom folder. Is that the version of npm you are running, or do you have another copy of npm in your path?

Check which npm is being run with:

command -v npm

Gotcha! I forgot to add the custom folder to my environment variables.

The previous result was:

$ command -v npm
/usr/bin

After adding /home/myuser/.npm-global/bin to PATH, the result is:

$ command -v npm
/home/myuser/.npm-global/bin

And:

$ npm -v
6.10.0

Thanks a lot!

1 Like