Skip to content
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

Merged
merged 3 commits into from
Oct 20, 2021

Conversation

tokt
Copy link
Contributor

@tokt tokt commented Sep 29, 2021

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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 29, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @tokt!

It looks like this is your first PR to kubernetes/contributor-site 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/contributor-site has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 29, 2021
@tokt
Copy link
Contributor Author

tokt commented Sep 29, 2021

/assign @parispittman

Copy link
Member

@idvoretskyi idvoretskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 30, 2021
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 11, 2021
@mrbobbytables mrbobbytables added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Oct 20, 2021
@mrbobbytables
Copy link
Member

Thanks!
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 20, 2021
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 20, 2021
@k8s-ci-robot k8s-ci-robot merged commit 7b966a4 into kubernetes:master Oct 20, 2021
chrismetz09 pushed a commit to chrismetz09/contributor-site that referenced this pull request Nov 29, 2021
…netes#245)

* Fixing npm error when building a docker image

* Fixing: "make container-server" vs "make container-serve"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants