-1

I just upgrade my npm to v5.3.0 and run into a problem: after I install/uninstall a module, npm would automatically clear my local modules that I manually put into my node_modules. These local modules are not included into package.json. This is really annoying. Please help, thanks.

E_net4
  • 27,810
  • 13
  • 101
  • 139
langtutheky
  • 183
  • 1
  • 11
  • 1
    You might be having an XY problem. You are _not_ supposed to put additional content into node_modules manually. Instead of insisting to change the behaviour of npm, you should find an alternative to your current approach. – E_net4 Jul 20 '17 at 23:34
  • @E_net4 Yeah, my current alternative is to npm link my local modules into node_modules but I would lose the links after cloning. The last alternative is to publish them as private modules? – langtutheky Jul 21 '17 at 00:08
  • 1
    Duplicate https://stackoverflow.com/questions/15806241/how-to-specify-local-modules-as-npm-package-dependencies – Darkrum Jul 21 '17 at 04:15
  • As well pointed out, there are better ways to specify dependencies that are not in a registry. – E_net4 Jul 21 '17 at 11:14

1 Answers1

-1

The solution is similar to the question How To Specify Local Modules As NPM Package Dependencies. The command is "npm install [path-to-local-module] --save". The local modules will be copied into the node_modules folder and their dependencies will be added to package.json.

langtutheky
  • 183
  • 1
  • 11