Reputation: 2451
I cloned some npm package from github and put the package in a local folder, e.g.
c:\git\package
I used "npm install -g" to install the package, which works really well.
npm install -g c:\git\package
However, when I did some change in the code of the package, e.g. checked out some branch. I couldn't use "npm update" to update the installed package. I have tried:
npm update -g
and
npm update -g packagename
or
npm update -g folderpath
Neither worked. I have to use "npm install" to reinstall it again for updating, which is wasting time to reinstall all dependencies.
Why does npm only support install from folder but not update from folder? If it does support, what shall I do? Thanks.
Upvotes: 9
Views: 6136
Reputation: 4527
Instead of npm install
from a local directory, try npm link
, which creates a globally-installed symlink to the directory.
As stated in the docs, this is a two-step process:
In package directory:
$ npm link
This creates a symlink to the current folder in npm's global installation directory.
Somewhere else, where you want to use the module:
$ npm link <pkgname>
This will create a symlink in your project's node_modules/
folder to the global installation.
Upvotes: 12