如何将我的node_module,模块添加到package.json [英] how to Add my node_module, modules into package.json

查看:405
本文介绍了如何将我的node_module,模块添加到package.json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的node_module文件夹中有一些模块,但是由于我在nodejs中是业余爱好者,因此当我要安装主题时,我忘记将--savenpm install一起使用.现在我有很多模块,但是我的为空,因此有什么方法可以将主题添加到package.json.
抱歉,如果我的问题很愚蠢,我是nodejs

I have some module in my node_module folder but because I am amateur in nodejs, when I wanted to install theme, I forgot to use --save with npm install.now I have lots of module but my package.json is empty so is there any way to add theme into package.json.
Sorry if my question is silly one I am beginner in nodejs

推荐答案

只需切换到包含node_modules的目录,在其中备份任何现有的package.json,然后使用npm init重新创建package.json.

Simply change into the directory containing node_modules, backup any existing package.json in there, then use npm init to re-create the package.json.

生成的package.json将包括node_modules中已经存在的所有模块.

The generated package.json will include any modules that already exist within node_modules.

样品运行:

$ cd /my/project
$ mv package.json package.json.bak # Backup package.json
$ npm init                         # Recreate package.json with dependencies populated

这篇关于如何将我的node_module,模块添加到package.json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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