0
votes

So I installed some modules with npm and others I just copied and pasted into the node_modules folder. One module I had to hack.

Now when I perform npm install for a new module, it deletes some of the modules and overwrites the hacked one to its original state.

It feels like I didn't run npm init early enough in development to properly set my package.json file from the start and now when I do run npm init it only picks up some of the modules.

How can I get everything synced up again? Is there a way to take a node_modules folder and get npm to become familiar with all the modules again? Also, is there any way to prevent the hacked one from going back to its original state?

Thank you!

1
1. Just reinstall the modules in your new NPM project to get them added to your package.json 2. You can't if you're updating that module.Andrew Li

1 Answers

0
votes

Here's an answer to a similar question

You can fork the repo of the "hacked" module and include the forked repo in your package.json file. As for the "copied" modules, you can either copy them outside your node_modules folder and import using relative paths, or install it as a local npm package.