在npm安装期间Gitlab CI失败

时间:2017-04-25 16:13:10

标签: docker npm gitlab-ci

你好,我在我的docker容器中的npm安装期间,在构建gitlab持续集成期间出现退出代码1错误。我在gitlab上托管了nodejs和angularjs中的javascript web应用程序,有两个存储库:一个用于前端,一个用于后端。在前面,我根据package.json使用包含节点7.7.1和nginx及其配置的基本映像,托管在Amazon注册表上,然后运行器执行前端的npm安装。

这是.gitlab-ci.yml:

image: docker:1.13.1

stages:
  - build
  - test
  - deploy

variables:
  BUILD_IMG: $CI_REGISTRY_IMAGE:$CI_BUILD_REF
  TEST_IMG: $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
  RELEASE_IMG: $CI_REGISTRY_IMAGE:latest
  AWS_STAGING_ENV: "argalisformation-prod-env"
  AWS_PROD_ENV: "argalisformation-prod-env"
  DOCKERRUN: Dockerrun.aws.json
  DEPLOY_ARCHIVE: ${AWS_APP}-${CI_BUILD_REF}.zip

before_script:
  - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
  - .ci/before_script

build:
  stage: build
  script:
  - docker build --pull -t $BUILD_IMG .
  - docker push $BUILD_IMG

test:
  stage: test
  script:
  - docker pull $BUILD_IMG
  - docker run --rm $BUILD_IMG npm run test
  - docker tag $BUILD_IMG $TEST_IMG
  - docker push $TEST_IMG

deploy:staging:
  stage: deploy
  environment: Staging
  variables:
    DOCKER_IMG: ${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}
  script:
  - ./.ci/create-deploy-archive $DOCKER_IMG $AWS_BUCKET $DOCKERRUN $DEPLOY_ARCHIVE
  - ./.ci/aws-deploy $DEPLOY_ARCHIVE $CI_BUILD_REF $AWS_STAGING_ENV
  artifacts:
    paths:
    - $DEPLOY_ARCHIVE
  except:
  - production

deploy:production:
  stage: deploy
  environment: Production
  variables:
    DOCKER_IMG: ${CI_REGISTRY_IMAGE}:latest
  script:
  - .ci/push-new-image $TEST_IMG $RELEASE_IMG
  - .ci/create-deploy-archive $DOCKER_IMG $AWS_BUCKET $DOCKERRUN $DEPLOY_ARCHIVE
  - .ci/aws-deploy $DEPLOY_ARCHIVE $CI_BUILD_REF $AWS_PROD_ENV
  artifacts:
    paths:
    - $DEPLOY_ARCHIVE
  only:
  - production
  when: manual

以下是跑步者错误的输出:

npm info lifecycle node-sass@3.13.1~install: node-sass@3.13.1

> node-sass@3.13.1 install /src/node_modules/sasslint-webpack-plugin/node_modules/node-sass
> node scripts/install.js



The command '/bin/sh -c npm set progress=false && npm install node-sass --save-dev && npm install' returned a non-zero code: 1
ERROR: Job failed: exit status 1

我的npm版本是4.1.2。

0 个答案:

没有答案