从现有的Node_Modules文件夹构建Package.Json? [英] Build Package.Json From Existing Node_Modules Folder?

查看:143
本文介绍了从现有的Node_Modules文件夹构建Package.Json?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个有效的node_modules文件夹,并且我尝试了许多package.json的排列,它们应该创建相同的结果并创建极其接近的结果,但是我的项目无法构建.我不知道如何解决这个问题.

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.

我已经使用npm list匹配了版本,并手动添加到了package.json中,我使用winMerge尝试查找差异.

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

我现有的node_modules文件夹可以工作,但是如果我重建它,它会失败.我机智了.

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

编辑 Node: 6.9.5NPM 4.2.0

推荐答案

您可以尝试使用shrinkwrap来确定现有node_modules文件夹中的依赖项.

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

请参见 https://docs.npmjs.com/cli/shrinkwrap

它应该创建一个npm-shrinkwrap,并使用npm shrinkwrap将所有版本固定到node_modules文件夹中当前使用的版本.

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

在第二个系统或第二个文件夹中,将npm-shrinkwrap.json放在package.json旁边,然后尝试npm install.在最佳情况下,它将完全按照现有位置来重新创建模块.

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?

这篇关于从现有的Node_Modules文件夹构建Package.Json?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆