Here's how to update express to version 4.0: npm update This done by adding the version number to the package name. If for some reason you don't want the latest version, perhaps because it may introduce breaking changes to your code, you can alternatively specify a specific version. You can do this in yarn by using the yarn upgrade command: yarn upgrade express Update a Specific Package to Specific Version
This command takes a package name as an argument and updates it to the latest version.įor example, here is how to update just express: npm update express To update a specific Node package, you can use the npm update command. Sometimes, you need to update a specific Node package, for example if it recently fixed a bug that you need. In this post, we'll learn how to use NPM to update a specific Node package. Updating a Specific Package to Latest Stable.Update a Specific Package to Specific Version.And this works for any other global npm package. Great thing is that npm can update itself. # navigate to nvm's node lib folder # (replace v8.4.0 with your version) cd ~/.nvm/versions/node/v8.4.0/lib/ # update npm right there npm install npm # reopen your terminal Once I found it, it was super easy to update npm in that specific folder. So I tried to find a path where global packages are installed when using nvm. I can't remember the exact error, but it was probably something with my PATH configuration.
However, when I was using a "system" node version, installed from Node.js website, it did. Recently I got npm update notification, that looks something like this:įor some reason, when I had node installed through nvm, npm i -g npm didn't work.
Node Version Manager is easy way to install, manage and work with multiple node versions. If you are JavaScript developer and not using nvm you might want to look at it.