npm library fails to install in GitLab CI - docker

My Docker image build has been failing to build lately and I've managed to trace down
where exactly it struggles.
When the runner is executing RUN npm install react-scripts#2.1.8 -g --silent --no-optional (from Dockerfile)
it fails and gives no error output to work with. Job log shows no clue as to why it failed.
I figured I could SSH into the CI server but GitLab doesn't support direct SSH access into CI server for debugging purposes.
My question is how can I debug this ? What steps I should take ? I don't deal every day with
bug where I get no error output.
What are the conditions in which GitLab runner may fail to install it ?
Note:
I ran it locally and no problem whatsoever hence it must be problem within the CI.

is the build of your image is ok in your computer ? You can also install a gitlab runner in your computer to test your gitlabci file

Try removing the --silent flag from the npm install command. I reckon you'll see a bit more then.

Timeout of the build runner was to blame in this particular case. As soon as I reorganized the code in build script npm library was successfully installed.

Related

Chaining Dockerfiles - after FROM, running npm no longer works?

I'm experimenting with docker. I have a simple dockerfile, which includes java and node.
https://github.com/Quafadas/scala-mill
https://github.com/Quafadas/scala-mill/blob/master/Dockerfile
It's published to dockerhub. Now, I'd like to build an application downstream
FROM quafadas/scala-mill:latest
RUN java -version
#This doesn't work :-(.
RUN npm --version
The command RUN npm --version works in the base image linked above, but apparently, not when I'm building on top of it using the FROM directive. Is anyone able to help me understand why?
/bin/sh: npm: command not found
15:15:19
The command '/bin/sh -c npm --version' returned a non-zero code: 127
enter code here
``
There seem to have been a few recent commits to the repo which has apparently fixed the issue! I was able to build and run the Dockerfile to get the npm version without any issues!
In case you need additional modules (such as npm) to be installed on a base image that doesn't provide it, use a multi-stage Dockerfile with different FROM commands to get your necessary dependencies onto a single Dockerfile and a docker image later. Reference.

Jenkins on ec2 not recognizing composer or npm - both are installed

I've installed Jenkins on an Amazon ec2 instance according to the instructions here https://www.jenkins.io/doc/book/installing/linux/#red-hat-centos and when I try to run a job that has an execute shell command step that does "composer install" or "npm install" it isn't recognizing either command. However from the terminal (as ec2-user) I can run both. Is there something I need to do to let Jenkins know where to find these commands?
I just realized I can sudo su jenkins and install composer as that user.
For NPM, this article helped. You need to install the nodejs plugin, restart Jenkins, then in the build environment section of the configuration of your job, choose "Provide Node & npm bin/ folder to PATH".
I was still having problems running ng commands - after installing the ng client as the jenkins user. This post helped - which says to add "npm run" before ng.
I hope this helps someone. Especially since I figured it out moments after offering my bounty!

How to deploy a angular project using Jenkins in windows

I'm trying to deploy an angular project using Jenkins. In the window bash, I used the command npm install and npm run ng -- build to install packages and to build the project. Later when I try to host using http-server it throws an error like 'http-server' is not recognized as an internal or external command, and it clearly shows it is not supporting any Angular-related commands in it. Suggest me anyway to solve this. Thanks in advance

How to run ui5 commands in jenkins

I am trying to build the project using the command :
ui5 build --all--
which totally works fine , produces a dist in my local pc inside my project folder using terminal
Now in JENKINS (* FYI OS - WINDOWS) - which is running locally , configured to get the code from GIT ,
Here When I tried executing the same command in Execute Windows Batch Command
When I try executing node commands for suppose node -v it gave me the version
May I know why not the ui5 doesn't work ? Am I required to do anything else here ?
I have tried executing CLI using the npm package manager:
npm install --global #ui5/cli
but still it shows me same err
Any help is much appreciated TIA
You have to install ui5 globally (as part of your docker image) or if it's in your local dev dependencies(recommend) run npm i && npx ui5 build

Building jhipster in Windows Jenkins

When I try to build JHipster on a windows Jenkins instance, I get the following error
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.trecloux:yeoman-maven-plugin:0.4:build (run-frontend-build) on project jhipster: Error during : cmd /c bower --version
I tried running Pprod clean package from the commandline and it works fine.
Any thoughts / Help appreciated.
That's because Jenkins's node environment is not complete, make sure bower is in its path. Bower should be installed using npm install -g bower
Please refer to our documentation about Jenkins setup: http://jhipster.github.io/setting-up-ci/
Thanks to Gaƫl Marziou, I zeroed in on the problem to access issues for the Jenkins user. I was able to solve it using the NodeJS plugin.

Resources