Package Exports
- fix-nvm-update
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fix-nvm-update) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
fix-nvm-update
fix-nvm-update quickly move all global npm packages from old Node version to new (only for versions, installed via NVM, without reinstalling.
Usage
You need a node version >=6.0.0.
Install fix-nvm-update localy or global, and set your current version of Node on first fix-nvm-update run:
$ fix-nvm-update v6.6.0
After installing new Node version just run fix-nvm-update with this new version:
$ nvm install v6.7.0
$ fix-nvm-update v6.7.0
Usually you can see all installed Node versions in directory ~/.nvm/versions/node. If on your system this directory has other path, you can change it in field nodes of config.json file in fix-nvm-update directory.
In last field of config.json you can manually set Node version (for moving packages from this version to new one).
Why
NVM offers a official way of updating: Migrating global packages while installing
nvm install v6.7.0 --reinstall-packages-from=v6.6.0
It works, but this solution has a problems:
- all packages reinstalled -- it's take a long time
- all packages reinstalled -- so they lose their internal "state" (but may be this is correct behaviour and packages should not have some state)
- old packages do not deleted, but they could weight more then 100 Mb
- old bin links do not deleted (but there is no real problem with that)
How
Let $NODES be the path of Node versions, $OLD -- your old Node version, and $NEW -- the new one. Then fix-nvm-update just run commands:
$ mv $NODES/$OLD/lib/node_modules/* $NODES/__TMP
$ mv $NODES/__TMP/npm $NODES/$OLD/lib/node_modules
$ mv $NODES/__TMP/* $NODES/$NEW/lib/node_modules
$ mv $NODES/$OLD/bin/* $NODES/__TMP
$ mv $NODES/__TMP/npm $NODES/__TMP/node $NODES/$OLD/bin
$ mv $NODES/__TMP/* $NODES/$NEW/bin
So, npm package, and bin links to npm and node do not moving.
Tests
18 tests via Mocha:
$ npm install
$ npm test