简体   繁体   English

Gitlab Runner工作失败

[英]Gitlab Runner Job failed

Our Gitlab Runner job always aborts when trying to make an npm install . 尝试进行npm install时,我们的Gitlab Runner作业总是中止。 It means that npm is not found or installed. 这意味着未找到或未安装npm。 It will be installed above and worked fine until a few days ago. 它将安装在上面,并且可以正常工作直到几天前。 Anyone have an idea? 有人有主意吗? I add our gitlab-ci.yml to the attachment, I'm a bit helpless... 我将gitlab-ci.yml添加到附件中,我有点无奈...

image: "ruby:2.5.5"

variables:
  RAILS_ENV: "test"
  GIT_DEPTH: "1"
  APT_PACKAGES: "nodejs postgresql postgresql-contrib libpq-dev sudo fontconfig bzip2 curl libxss1 libappindicator1 libindicator7 libpango1.0-0 fonts-liberation xdg-utils cmake"

cache:
  key: "ruby-255"
  paths:
  - vendor/ruby
  - vendor/apt
  - node_modules
  - frontend/node_modules
  - frontend/bower_components

before_script:
  # Setup deploy key
  - mkdir -pv ~/.ssh
  - echo "StrictHostKeyChecking no" >> ~/.ssh/config
  - eval $(ssh-agent -s)
  - ssh-add <(echo "$DEPLOY_KEY")

  # Install dependencies
  - mkdir -pv vendor/apt
  - curl -sL https://deb.nodesource.com/setup_8.x | bash -
  - apt-get -o dir::cache::archives="vendor/apt" update -yqqq
  - apt-get -o dir::cache::archives="vendor/apt" install -y -qq --force-yes --no-install-recommends $APT_PACKAGES

  # Setup phantomjs
  - curl --silent --show-error --location --fail --retry 3 https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 | tar xjfO - phantomjs-2.1.1-linux-x86_64/bin/phantomjs > /usr/bin/phantomjs && chmod +x /usr/bin/phantomjs

  # Install node packages, gems and tools, configure and run bundler
  - gem install bundler
  - npm -g install eslint@v4.6.1 ember-cli yarn@v1.1.0 bower
  - RAILS_ENV=test bundle install --path vendor --without development --jobs $(nproc) "${FLAGS[@]}"
  - RAILS_ENV=test bundle lock --add-platform java

  # Setup postgresql database
  - /etc/init.d/postgresql start
  - sudo -u postgres psql -U postgres -d postgres -c "alter user postgres with password 'postgres';"

  # Setup the build
  - cp .env.ci .env
  - RAILS_ENV=test bin/build

stages:
  - check

setup:
  stage: check
  script:
    - node -v
    - npm -v
    - ruby -v
    - bin/check

After the line 'npm -g install eslint@v4.6.1 ember-cli yarn@v1.1.0 bower' comes the following error: /bin/bash: line 103: npm: command not found ERROR: Job failed: exit code 1 . 在“ npm -g install eslint@v4.6.1 ember-cli yarn@v1.1.0 bower”行之后,出现以下错误: /bin/bash: line 103: npm: command not found ERROR: Job failed: exit code 1

My Gitlab Version: 我的Gitlab版本: gitlab版本

ruby:2.5.5 image you use doesn't contain npm executable : ruby:2.5.5您使用的图片不包含npm可执行文件:

docker run -it --rm ruby:2.5.5 npm -version
/usr/bin/docker-current: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"npm\": executable file not found in $PATH".

Try to use ruby-node image instead : 尝试改用ruby-node图像:

docker run -it --rm starefossen/ruby-node /bin/bash -c "ruby -v; node -v; npm -v"
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
v10.8.0
6.2.0

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

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