w3resource

Troubleshooting


This section is dedicated for the common errors that can occur while using npm.

There are cases where you honestly followed this tutorial or the npm documentation and still had errors either due to the version of node you installed or the version of npm that you are working with. It could even be that you mistakenly broke npm. This series will help you resolve these issues.

Try the latest version on node

In the case where you are experiencing issues while using a version of node that is unsupported or unstable (usually odd numbered versions of npm e.g 0.7.x, 0.9.x, 0.11.x) it is very possible that your issue can be fixed by using the LTS (long term support) version of node.

To see the version of node that you are working with, you can run:

node -v

Updating node on Linux

Most Linux distributions (Debian/Ubuntu and RedHat/CentOS), the latest node version that is provided by the distribution may lag behind the stable version. An instruction of getting the latest version can be found here https://github.com/nodesource/distributions.

Updating node on Windows

You can install the latest msi from https://nodejs.org/en/download

Updating node on OSX

You can install the latest package from https://nodejs.org/en/download

Or by running

brew install node

in the case where you are using homebrew

A very easy way to stay up-to-date

There are many versions of Node.js, and it is in very active development. As a good practice to manage the various npm versions, it is recommended that you use a version manager for your Node.js installation. There are lots of great options available for you, namely:

  • NVM
  • nodist
  • n
  • nave
  • nodebrew

Previous: Npm-shrinkwrap.json
Next: Try the latest stable version of npm



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/npm/try-the-latest-version-on-node.php