简体   繁体   English

在npm中执行npm install和bower的一个命令?

[英]One command to npm install and bower in npm?

A friend of mine said maven is king and npm and bower sucks because you have to run 2 commands. 我的一个朋友说,行家是国王和npm,而凉亭很烂,因为您必须运行2条命令。 "npm install"... wait... then run "bower install". “ npm install” ...等待...然后运行“ bower install”。 I heard node's package.json is able to support scripts. 我听说节点的package.json能够支持脚本。 Is there a way for me to modify package.json so that I can do something like "npm setupmyproject" that will run both the npm install and bower install commands, then execute a grunt task? 有没有办法修改package.json,以便我可以执行“ npm setupmyproject”之类的操作,使其同时运行npm install和bower install命令,然后执行grunt任务? That way I can have one command to hit three birds? 这样一来我就可以命中三只鸟?

Yes, you could add a single script to perform all those operations, eg 是的,您可以添加一个脚本来执行所有这些操作,例如

{
  "scripts": {
    "setup": "npm install && bower install && grunt build"
  }
}

Then you'll be able to run it with 然后您就可以运行它了

npm run setup

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM