Composer post-install-cmd 因 travis-ci 中的多个命令而失败
Composer post-install-cmd is failing with multiple commands in travis-ci
我正在学习构建一个项目,以便轻松协作和持续集成。所以我创建了一个 branch 我的 WordPress 插件。
我制作了composer.json
:
"scripts": {
"post-install-cmd": ["npm install", "grunt"],
"pre-archive-cmd": "composer install"
}
它在 Windows 机器上的本地安装中表现不错,并且在 运行ning npm install
加载了所有依赖项后,它可以 运行 grunt
。但是使用 Travis CI 它失败了:
Script npm install && grunt handling the post-install-cmd event returned with error code 3
The command "composer install" failed and exited with 3 during .
所以,我将命令更改为 this:"npm install && grunt"
,但也失败了。
然后我通过了 single command: "npm install"
in post-install-cmd
.
我在这里做错了什么?为什么 multiple 命令在本地环境中运行良好,但在 Travis CI 中却不行?错误代码 3 到底是什么?
我认为你需要告诉 travis 安装 npm & grunt 才能使用它。
before_script:
- npm install -g grunt-cli
- npm install
如我所见https://github.com/nanodesigns/nanosupport/blob/testing/.travis.yml
它在您的 travis 文件中丢失。
更新:
您还需要指定节点版本,或者使用 package.json:
中的 engines 指令
{ "engines" : { "node" : ">=4" } }
或通过 ENV 变量
env:
- TRAVIS_NODE_VERSION="4"
我正在学习构建一个项目,以便轻松协作和持续集成。所以我创建了一个 branch 我的 WordPress 插件。
我制作了composer.json
:
"scripts": {
"post-install-cmd": ["npm install", "grunt"],
"pre-archive-cmd": "composer install"
}
它在 Windows 机器上的本地安装中表现不错,并且在 运行ning npm install
加载了所有依赖项后,它可以 运行 grunt
。但是使用 Travis CI 它失败了:
Script npm install && grunt handling the post-install-cmd event returned with error code 3
The command "composer install" failed and exited with 3 during .
所以,我将命令更改为 this:"npm install && grunt"
,但也失败了。
然后我通过了 single command: "npm install"
in post-install-cmd
.
我在这里做错了什么?为什么 multiple 命令在本地环境中运行良好,但在 Travis CI 中却不行?错误代码 3 到底是什么?
我认为你需要告诉 travis 安装 npm & grunt 才能使用它。
before_script:
- npm install -g grunt-cli
- npm install
如我所见https://github.com/nanodesigns/nanosupport/blob/testing/.travis.yml 它在您的 travis 文件中丢失。
更新: 您还需要指定节点版本,或者使用 package.json:
中的 engines 指令{ "engines" : { "node" : ">=4" } }
或通过 ENV 变量
env:
- TRAVIS_NODE_VERSION="4"