简体   繁体   中英

How to make a package.json from hacked node_modules folder

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!

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM