【发布时间】:2018-08-02 06:25:59
【问题描述】:
我正在尝试在 Jenkins 上配置我的项目,以便每次提交都会导致自动构建。
当我使用 Jenkins NodeJS 脚本运行 yarn install 时,它拒绝安装从 git 存储库导入的依赖项。我正在按照以下方式进行操作。
"some-component": "git+https://bitbucket.org/owner/repo.git"
它显示以下错误:
error Command failed.
Exit code: 128
Command: git
Arguments: clone git+https://bitbucket.org/owner/repo.git
Output:
fatal: destination path 'some path' already exists and is not an empty directory.
error Command failed with exit code 1.
如果文件为空,则显示以下错误
error Couldn't find the binary git
error Command failed with exit code 1.
虽然相同的 yarn install 在 IDE 上完美运行,例如VS 代码。
我正在使用以下代码在 Jenkins 上的 NodeJS 脚本中执行 yarn install
var exec = require('child_process').exec,
child;
child = exec('yarn install ',
function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
【问题讨论】:
标签: node.js reactjs jenkins npm yarnpkg