node.js NPM:如何只运行安装后?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31000392/
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
NPM : how to just run post-install?
提问by noelm
Just a simple question : in my node.js project, how could I just run the postinstall script, without running install before ?
只是一个简单的问题:在我的 node.js 项目中,我怎么能只运行 postinstall 脚本,而不运行 install before?
FYI, this is my package.json :
仅供参考,这是我的 package.json :
{
"name": "gestionclientjs",
...,
"dependencies": {
...
},
"repository": {},
"devDependencies": {
...
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "grunt test",
"postinstall" : "bower install && node ./app/server/dbSeed.js",
"start": "node app/server/app.js"
}
}
For now, I run :
现在,我运行:
npm install
in my project, but I want to run
在我的项目中,但我想运行
npm postinstall
when I want (and when I'm sure dependencies are ok).
当我想要时(并且当我确定依赖项没问题时)。
回答by robertklep
You can run individual script entries using npm run SCRIPTNAME:
您可以使用npm run SCRIPTNAME以下命令运行单个脚本条目:
$ npm run postinstall

