Gitlab CI不执行npm脚本 [英] Gitlab CI does not execute npm scripts

查看:235
本文介绍了Gitlab CI不执行npm脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使CI脚本在gitlab运行程序上运行。



我想要的很简单:



首先应执行npm install命令以获取所有必需的npm软件包。



之后,进行 npm测试 npm运行构建应该执行。



.gitblab-ci.yml 脚本如下所示:

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

阶段:
-测试
-建立

运行测试:
脚本:
-npm测试
阶段:测试

生成:
脚本:
-npm运行生成
阶段:生成

不幸的是,只有 npm安装被执行了两次。 b b bb b b b b b b b p>

有人可以告诉我,我做错了什么吗?

解决方案

类似的问题:

 设置:
阶段:安装
脚本:
-npm install
-echo done

但是 echo done 从未执行。解决方法是在 npm 之前添加呼叫

 设置:
阶段:安装
脚本:
-调用npm install
-echo done

这里是详细信息。显然,它与Windows如何批量执行批处理有关。


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?

解决方案

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.

这篇关于Gitlab CI不执行npm脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆