Updating a local file dependency using npm

I have a project with a local file dependency in my package.json as follows:

 "dependencies": { "dep_1": "file:../../dep_1" } } 

When I do npm install , it installs in node_modules. But if I make changes to dep_1 , how do I update the module version in node_modules?

I tried to do npm update , but nothing happens.

+7
source share
1 answer

If you are using a relatively new version of npm (I used version 2.14.2), you can damage the version number in package.json and npm update dep_1 . Otherwise, how can npm know that something needs to be updated?

Note. . This will only work if the version is higher than previously installed. You will have to clear the cache before resetting this behavior.

However, you can force (and lazily) update local modules by simply running npm install again. eg.

 npm install dep_1 

It should be fast, since it is located on your local computer, and you do not need to play with version numbers.

See the discussion of this issue on the official npm repository page for more details: https://github.com/npm/npm/issues/7426

+6
source share

All Articles