-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing npm error when building a contributor-site docker image #245
Conversation
Welcome @tokt! |
/assign @parispittman |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Thanks! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: idvoretskyi, mrbobbytables, tokt The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…netes#245) * Fixing npm error when building a docker image * Fixing: "make container-server" vs "make container-serve"
Hello.
Trying to follow instructions and build a docker image to run contributor website locally.
Getting below error from npm:
make container-image
docker build . -t k8s-contrib-site-hugo --build-arg HUGO_VERSION=0.69.2
Sending build context to Docker daemon 25.65MB
Step 1/8 : FROM alpine:latest
---> 14119a10abf4
Step 2/8 : ARG HUGO_VERSION=0.69.2
---> Using cache
---> 9f0b486ae2a6
Step 3/8 : RUN apk add --no-cache bash build-base curl git grep libc6-compat rsync sed npm
---> Using cache
---> 0d785ca3bfea
Step 4/8 : RUN npm install -G autoprefixer postcss-cli
---> Running in 46980f105b5d
npm ERR! Tracker "idealTree" already exists
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-09-29T18_08_36_087Z-debug.log
The command '/bin/sh -c npm install -G autoprefixer postcss-cli' returned a non-zero code: 1
make: *** [Makefile:56: container-image] Error 1
According to StackOverflow: https://stackoverflow.com/questions/57534295/npm-err-tracker-idealtree-already-exists-while-creating-the-docker-image-for all we have to do is specify WORKDIR before running npm install:
This issue is happening due to changes in nodejs starting version 15. When no WORKDIR is specified, npm install is executed in the root directory of the container, which is resulting in this error. Executing the npm install in a project directory of the container specified by WORKDIR resolves the issue.
I believe it's a trivial fix, please, let me know if you'd like me to open an issue first.