Marcin
Marcin

Reputation: 175

Dockerfile- error during installing cypress

I have a problem with configuration of dockerfile. I want to docker image with cypress. Here is my code in dockerfile

FROM alpine
RUN apk add --update nodejs npm
RUN npm install cypress --save-dev
RUN npm install --save-dev mochawesome
RUN npm install --save-dev mochawesome-merge

In the gitlab pipeline I'm getting error

Step 3/5 : RUN npm install cypress --save-dev ---> Running in a67113336059 npm ERR! Tracker "idealTree" already exists npm ERR! A complete log of this run can be found in: npm ERR!
/root/.npm/_logs/2022-11-14T13_13_39_675Z-debug-0.log The command '/bin/sh -c npm install cypress --save-dev' returned a non-zero code: 1 Cleaning up project directory and file based variables 00:00 ERROR: Job failed: command terminated with exit code 1

Can you give me a some tips what am I doing wrong ? ;/ Thanks for any help :)

Upvotes: 1

Views: 903

Answers (1)

Matthieu Mabillard
Matthieu Mabillard

Reputation: 91

If you analyze the output, you have the following error:

npm ERR! Tracker "idealTree" already exists npm ERR!

This is due to a change in NodeJS > 15.0. When no WORKDIR is specified, the command is executed in the root folder, which provokes the error you have. The workaround is to specify explicitly the WORKDIR by adding the following statement to your Dockerfile:

WORKDIR <the_place_where_you_have_installed_your_app>

PS: By curiosity I have googled your problem and found a lot of answers like this one for example: npm ERR! Tracker "idealTree" already exists while creating the Docker image for Node project

Upvotes: 1

Related Questions