How to: Migrating Global Packages While Installing
If you want to install a new version of Node.js and migrate npm packages from a previous version:

```sh
nvm install --reinstall-packages-from=node node
```

This will first use "nvm version node" to identify the current version you're migrating packages from. Then it resolves the new version to install from the remote server and installs it. Lastly, it runs "nvm reinstall-packages" to reinstall the npm packages from your prior version of Node to the new one.

You can also install and migrate npm packages from specific versions of Node like this:

```sh
nvm install --reinstall-packages-from=5 6
nvm install --reinstall-packages-from=iojs v4.2
```

Note that reinstalling packages _explicitly does not update the npm version_ — this is to ensure that npm isn't accidentally upgraded to a broken version for the new node version.

To update npm at the same time add the `--latest-npm` flag, like this:

```sh
nvm install --reinstall-packages-from=default --latest-npm 'lts/*'
```

or, you can at any time run the following command to get the latest supported npm version on the current node version:
```sh
nvm install-latest-npm
```

If you've already gotten an error to the effect of "npm does not support Node.js", you'll need to (1) revert to a previous node version (`nvm ls` & `nvm use
`), (2) delete the newly created node version (`nvm uninstall
`), then (3) rerun your `nvm install` with the `--latest-npm` flag.