git 如何使用 npm 重建节点模块?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36544553/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to rebuild node modules with npm?
提问by Vivien Adnot
I'm a complete beginner at Node so maybe my question is probably very naive, sorry about that.
我是 Node 的完全初学者,所以我的问题可能非常幼稚,对此我深表歉意。
I created my first project at work with Grunt.
我在与 Grunt 合作时创建了我的第一个项目。
Grunt uses Node, so now I have a nice folder node_modulesat the root of my project, with several modules inside. Everything is working fine.
Grunt 使用 Node,所以现在我node_modules在项目的根目录下有一个不错的文件夹,里面有几个模块。一切正常。
I added node_modules/*in my .gitignore, assuming that I would rebuild it easily from another place.
我添加node_modules/*了 my .gitignore,假设我可以从另一个地方轻松重建它。
Then I go home, I retrieve my project with git and now I don't know how to rebuild the node modules.
然后我回家,我用git检索我的项目,现在我不知道如何重建节点模块。
Is there an npmcommand that would read package.json?
是否有npm可以读取的命令package.json?
回答by Eye
Try npm i, a short version of npm installinside your directory where package.jsonexists.
尝试npm i,npm install在您的目录中package.json存在的简短版本。

