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
`-- gulp#3.9.1
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.
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
Related
I have just started using pnpm thanks to this cool template https://github.com/NiGhTTraX/ts-monorepo
and at one point, I cleaned all node_module folders with the command
find . -name "node_modules" | xargs rm -rf
Now when I run pnpm install && pnpm run build, I get the following output about rimraf not being found :(
dean#Deans-MacBook-Pro typescript % pnpm run build
> ts-monorepo# build /Users/dean/workspace/gazehealth/gazehealth/typescript
> lerna run build
lerna notice cli v4.0.0
lerna info versioning independent
lerna info Executing command in 9 packages: "pnpm run build"
lerna ERR! pnpm run build exited 1 in '#nighttrax/apiUsers'
lerna ERR! pnpm run build stdout:
> #nighttrax/apiUsers#1.0.0 build /Users/dean/workspace/gazehealth/gazehealth/typescript/libraries/apiUsers
> pnpm run clean && pnpm run compile
> #nighttrax/apiUsers#1.0.0 clean /Users/dean/workspace/gazehealth/gazehealth/typescript/libraries/apiUsers
> rimraf -rf ./dist
ERROR Command failed.
ERROR Command failed with exit code 1.
lerna ERR! pnpm run build stderr:
sh: rimraf: command not found
lerna ERR! pnpm run build exited 1 in '#nighttrax/apiUsers'
lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
ERROR Command failed with exit code 1.
How to fix this? Ideally 'not' with a global install so other developers systems will work when they git clone the repo (ideally developers should not have to install stuff much like gradle & it's gradle wrapper did for java)
I am trying to integrate cypress to the bitbucket pipeline. And I am following the official documentation:
- step:
script:
# install dependencies
- npm ci
# run Cypress tests
- npm run e2e (env variables here)
I launch the container locally as follows:
docker run -v `pwd`:/mycode -it imagename /bin/sh
cd /mycode
and I run the steps in the script:
/mycode# npm ci; npm run e2e (env variables here)
But I get the following error:
/root/.cache/Cypress/8.2.0/Cypress/Cypress: error while loading shared libraries: libgbm.so.1: cannot open shared object file: No such file or directory
I ran apt-get install xvfb libgtk2.0-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2, as per documentation when I got libgtk2.0-0 missing dependency and it threw the next one.
I also have added :nvm install "lts/*" --reinstall-packages-from="$(nvm current)" as a step to update node to the latest version and match cypress requirements,
but is there any general practice on how to integrate cypress in an existing project's pipeline and to work around these library issues?
Is the fix just to install the library or is there a better integration practice and something I'm missing?
You can actually use an official cypress image only for the step where you want to run the tests. You can choose the version which suits you the best.
- step:
name: run tests
image: cypress/browsers:node12.18.3-chrome87-ff82
script:
# install dependencies
- npm ci
# run Cypress tests
- npm run e2e (env variables here)
Sorry for asking this, but how can i build the botframework-webchat v4.5.2? I ran 'npm run bootstrap' and 'npm run build'. Both commands exited successfully, but i can't find the webchat.js file.
You need to run npm run build:sample when you are first getting started. Then the normal build and watch commands should build the webchat.js files from then on. Not sure if this is documented anywhere.
npm install
npm run bootstrap
npm run build:sample
npm run build
To run the test harness run npm run start:docker and wait for the command to finish - it should take awhile for docker container to build. Then in another terminal run npm test.
Hope this helps!
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.
I'm trying to move the post deploy commands from out of my package.json's postinstall line, and instead to utilise the run object in my .travis.yml but it doesn't seem to invoke the commands.
deploy:
provider: heroku
run:
- "npm install"
- "node_modules/bower/bin/bower install"
- "node_modules/grunt-cli/bin/grunt build:production"
api_key:
secure: ...
app: node-snapshot
on:
repo: Wildhoney/Snapshot.js
Even when I remove the directory, and just invoke bower install it still does nothing. I've also done a heroku run bash -a node-snapshot and the ls for that shows a strange vendor directory in the root with node inside of it, but the Bower dependencies and the result of grunt build:production are nowhere to be found.
Ideas?