简体   繁体   English

如何从node_modules文件夹添加您的package.json依赖项?

[英]How to add your package.json dependencies from node_modules folder?

I was working on a project and i accidentally deleted my package.json file then i again used npm init command to create new one but i already had a lot of gulp extensions in my node_modules... 我正在一个项目上, 不小心删除了package.json文件,然后再次使用npm init命令创建了一个新文件,但是我的node_modules中已经有很多gulp扩展了...

So now how can i add those dependencies again back to my new package.json file 所以现在我该如何再次将这些依赖项添加回我的新package.json文件中

How can a package.json file be get list of dependencies from my node_modules folder? 如何从我的node_modules文件夹获取package.json文件的依赖项列表?

you can alternatively list all installed dependencies using: 您也可以使用以下方法列出所有已安装的依赖项:

npm list --depth=0

and then manually add them to your package.json file 然后手动将它们添加到package.json文件中

if you want to get globally installed packages, use 如果要获取全局安装的软件包,请使用

npm list -g --depth=0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从被入侵的node_modules文件夹中制作package.json - How to make a package.json from hacked node_modules folder 是否可以从项目package.json中覆盖node_modules / protracor / config.json? - Is it possible to override node_modules/protracor/config.json from the project package.json? 如何将节点模块的脚本从 package.json 文件添加到根 package.json 文件 - How to add a Node Module's script from the package.json file to the Root package.json file NPM 脚本(在 package.json 中)不使用 node_modules/.bin 目录 - NPM-Scripts (in package.json) doesn't use the node_modules/.bin directory 如何在 package.json 中拥有来自不同注册表的 npm 依赖项? - How to have npm dependencies from different registries in the package.json? 从package.json安装依赖项时出错 - error installing dependencies from package.json Node.js 中的 package.json 中未显示依赖项 - dependencies not showing in package.json in Node.js 如何在 package.json 中添加新脚本 - How to add a new script in package.json 有没有一种方法可以将package.json文件中的依赖项安装到其他目​​录中? - Is there a way to install dependencies from a package.json file into a different directory? 使用jq从package.json中提取有关依赖项的信息 - Using jq to extract information about dependencies from package.json
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM