Nvm: Anyway to copy over the global packages installed from one version to another?

Created on 25 Nov 2013  路  4Comments  路  Source: nvm-sh/nvm

So whenever I upgrade to another Node version, I have to remember reinstalling all the global packages again which is kinda inconvenient. I know this is apparently by design, but am wondering if we can provide a better way to help this situation?

Most helpful comment

nvm use 0.10.24; nvm copy-packages 0.10.23 is the way to do this.

All 4 comments

I just hopped into the issues to find this out myself. Seems I lose most of the benefit nvm provides if all my packages don鈥檛 have an easy migration path. Since I鈥檓 not generally hacking on node, rather using npm for front-end stuff like grunt and yo I have a little looser tolerances for not needing to know how the bare-metal has changed.

Rbenv got a default gems plugin, which are installed when a newer version of ruby is installed. So maybe a file default-packages in the NVM_DIR can be checked after installation?

There's a nvm copy-packages <version> that does this, but it's buggy because it gets the list of packages by doing:

`nvm use $VERSION > /dev/null && npm -g -p ll | \grep "$ROOT\/[^/]\+$" | cut -d   '/' -f 8 | cut -d ":" -f 2 | \grep -v npm | tr "\n" " "`

That first cut assumes that $ROOT is exactly 6 levels deep (which is the case if you have nvm in something like /home/user/nvm)

nvm use 0.10.24; nvm copy-packages 0.10.23 is the way to do this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arnavb picture arnavb  路  3Comments

cdelorme picture cdelorme  路  5Comments

tongxiaofeng picture tongxiaofeng  路  5Comments

goalidea picture goalidea  路  3Comments

pixelchutes picture pixelchutes  路  3Comments