Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitLab runner only executing one command

I have the following configuration in .gitlab-ci.yml:

stages:
- build

build:
  stage: build
  script:
    - npm install -g gulp
    - npm install
    - gulp

But the runner is only executing the first command (npm install -g gulp). It runs the first command and reports success, without executing the others.

The build log:

Running with gitlab-ci-multi-runner 1.6.1 (c52ad4f)
Using Shell executor...
Running on WINBUILDER...

Fetching changes...

HEAD is now at 2df18c5 Update .gitlab-ci.yml
From https://.../client
   2df18c5..b4efae8  master     -> origin/master
Checking out b4efae85 as master...

$ npm install -g gulp

C:\Users\Administrator\AppData\Roaming\npm\gulp -> C:\Users\Administrator\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js
C:\Users\Administrator\AppData\Roaming\npm
`-- [email protected] 

Build succeeded

I've seen several config examples using multiple commands in a stage. I don't understand why the other commands are not running.

like image 927
karliwson Avatar asked Nov 20 '25 08:11

karliwson


1 Answers

It's actually an NPM bug as described here:

https://github.com/npm/npm/issues/2938

NPM closes the shell upon exit and subsequent commands are not called.

A workaround is described in the issue above. Just add a call command before calling NPM:

stages:
- build

build:
  stage: build
  script:
    - call npm install -g gulp
    - call npm install
    - gulp
like image 57
karliwson Avatar answered Nov 23 '25 04:11

karliwson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!