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 ?
CodePudding user response:
@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