Gitlab CI does not execute npm scripts

江枫思渺然 提交于 2019-12-10 13:19:45

问题


I try to make a CI script running on a gitlab runner.

What I want is simple:

First the npm install command should be executed to fetch all the required npm packages.

After that the npm test and npm run build should be executed.

The .gitblab-ci.yml script looks as follow:

before_script:
  - cd my/folder/
  - npm install --silent

stages:
  - test
  - build

run_tests:
  script:
    - npm test
  stage: test

build:
  script:
    - npm run build
  stage: build

Unfortunatly only the npm install gets executed twice. And this not silent.
npm test and npm run build get never called.

Can anyone tell me, what I do wrong?


回答1:


I had similar problem:

setup:                                                                                          
    stage: setup
    script:
        - npm install
        - echo "done"

But echo "done" was never executed. Solution was to add call before npm:

setup:                                                                                          
    stage: setup
    script:
        - call npm install
        - echo "done"

Here are details. Apparently it has something to do how windows execute batch in batch.



来源:https://stackoverflow.com/questions/43427657/gitlab-ci-does-not-execute-npm-scripts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!