在我的 composer.json
中,有一个 postinstall
Hook 设置,如下所示:
"scripts" : {
"dist" : "node dist; node_modules/.bin/doccoh src/package.js",
"postinstall" : "node_modules/.bin/grunt setup || true; node_modules/.bin/bower install",
"start" : "node server.js"
}
每当我运行它时(从 Git/Gnu Bash CLI 在 Win 上运行),我都会以
结束
command not found. either the command was written wrong or couldn't be found
德语 CLI 错误的粗略翻译。
我尝试将其拆分为多个 ;
/分号分隔的部分,并首先将 cd
放入该目录,但它最终会得到相同的错误消息。用一个简单的 ls
替换整个 postinstall
命令集确实有效。所以我猜问题可能是分号分隔或命令的错误使用。但总的来说,我不知道出了什么问题。
注意:我全局安装了 grunt-cli
0.1.9 版和 grunt
0.4.1 版。
最佳答案
我回答得有点晚了,但是如果您使用的是 Windows,则使用 && 执行单行上的多个命令
postinstall: "some command && some other -c"
关于node.js - npm postinstall 使用多个命令失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18621489/