npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fix-nvm-update

v2.0.4

Published

Migrating global npm packages to new Node.js version (nvm only)

Downloads

8

Readme

fix-nvm-update

NPM version Build status node dependencies License MIT

NPM version

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:

$ fix-nvm-update set last v6.6.0

Check your nvm nodes directory (~/.nvm/versions/node by default):

$ fix-nvm-update get

If needed, change it:

$ fix-nvm-update set nodes /home/user/.nvm/versions/node

After installing new Node version just run fix-nvm-update with this new version:

$ nvm install v6.7.0
$ ../src/fix-nvm-update.js v6.7.0

It's not a problem if fix-nvm-update installed globaly and move itself with other global packages. In this case your need run fix-nvm-update from old Node version (because new version has not global packages yet):

$ nvm install v6.7.0
$ nvm use v6.6.0
$ fix-nvm-update v6.7.0
$ nvm use v6.7.0

Now all global packages are in v6.7.0 (includes fix-nvm-update).

This will show usage and version:

$ fix-nvm-update help

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)

But simple moving packages to new Node version directory works very quickly. fix-nvm-update does it carefully with full logging (in stdout).

How

Let current directory is the path of Node versions, old -- your old Node version, and new -- the new one. Then fix-nvm-update just run commands:

$ mkdir tmp

$ mv old/lib/node_modules/* tmp
$ mv tmp/npm old/lib/node_modules
$ mv tmp/* new/lib/node_modules

$ mv old/bin/* tmp
$ mv tmp/npm tmp/node nodes/old/bin
$ mv tmp/* new/bin

$ rmdir tmp

So, npm package, and bin links to npm and node do not moving.

Tests

30 tests via Mocha:

$ npm install
$ npm test

Travis: https://travis-ci.org/uid-11222/fix-nvm-update.

License

MIT