Gitlab Runner 作业失败

Gitlab Runner Job failed

我们的 Gitlab Runner 作业在尝试创建 npm install 时总是中止。这意味着没有找到或安装 npm。它将安装在上面并且在几天前工作正常。有人有想法吗?我把我们的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

行'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.

我的Gitlab版本:

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".

尝试使用 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