如何将我的node_module,模块添加到package.json [英] how to Add my node_module, modules into package.json
问题描述
我的node_module文件夹中有一些模块,但是由于我在nodejs
中是业余爱好者,因此当我要安装主题时,我忘记将--save
与npm 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屋!