1

My project package.json has node-sass:"^4.14.1" and I need to containerise it. My application in local works on node: 14.17.4, I cant change any dependencies whatsoever. When I'm trying to do a npm install in dockerfile I'm gettiing can't find [email protected](node-sass needs py2.7 installed to install itself correctly). Im installing py2.7 but somehow docker is not able to pick it up

FROM node:14.17.4-alpine

RUN npm install --python=python2.7

WORKDIR /app

COPY client /app

ENV PYTHONPATH "${PYTHONPATH}:/usr/bin/python27"

RUN npm ci

EXPOSE 7092

CMD ["npm","run","devserver"]

It gives me the following error while doing npm ci in docker build . command

#9 34.39 gyp verb check python checking for Python executable "python2" in the PATH
#9 34.39 gyp verb `which` failed Error: not found: python2

Probably the path Im setting is wrong, Can someone guide here ?

1
  • 3
    To the best of my ability to inspect the node:14.17.4-alpine image, it doesn't include Python at all. You will want to apk add python2 before the npm install Commented Oct 13, 2022 at 7:41

1 Answer 1

1

@tripleee is correct. you're declaring an environment variable in your docker container called PYTHONPATH, which shouldn't be needed if python2 is installed properly with RUN apk add python2

relevant SO post

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.