没有在gitlab ci中find纱线命令
我想configuration我的gitlab-ci使用yarn install
而不是npm install
我目前的gitlab-ci.yml如下所示:
image: node:6.9.4 cache: paths: - node_modules/ - .yarn before_script: - apt-get update -qq && apt-get install -qy libelf1 stages: - test test_core: stage: test script: - yarn config set cache-folder .yarn - yarn install - npm run build - npm run test tags: - 2gb
但是编译失败,错误: /bin/bash: line 48: yarn: command not found
有什么我失踪? 我试着安装纱线:
curl -o- -L https://yarnpkg.com/install.sh | bash
这给了我相同的错误,可能是因为我需要重新加载bash环境,以使yarn命令可用。
上面的configuration与npm install
完美配合。
请帮我解决这个问题。 如果在我的configuration文件中缺less某些东西,或者gitlab-ci有问题。 谢谢。
通过使用最新的官方节点泊坞窗图像解决它。 由于image: 6.10.0
,图像中默认安装了纱线。
但是,如果您需要node-gyp
来构build任何包,则需要通过向脚本添加一行来安装它:
yarn global add node-gyp
纱线安装后,将以下内容添加到您的ci脚本中:
export PATH=$HOME/.yarn/bin:$PATH