Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build Package.Json From Existing Node_Modules Folder?

Tags:

node.js

npm

I have a node_modules folder that works, and I have tried many permutations of package.json's that should create identical results and create extremely close results, but my project will not build. I have no idea how to remedy this problem.

I have matched versions using npm listand manually adding to my package.json, I have used winMerge to try to find differences.

My existing node_modules folder works, but if I rebuild it, it fails miserably. I am at wit's end.

Edit Node: 6.9.5 and NPM 4.2.0

like image 592
Slbox Avatar asked Feb 21 '17 15:02

Slbox


1 Answers

You could try to use shrinkwrap to nail down the dependencies from your existing node_modules folder.

See https://docs.npmjs.com/cli/shrinkwrap

It should create a npm-shrinkwrap with all versions nailed to the ones currently used in the node_modules folder with npm shrinkwrap.

On the second system or in the second folder put the npm-shrinkwrap.json besides the package.json and try a npm install. In the optimal case it will recreate your modules exactly as in the existing location.

If that does not help - can you post some more detailed error outputs?

like image 91
Frank Schmid Avatar answered Oct 24 '22 06:10

Frank Schmid