1

I've just read the best practices about Global npm dependencies and tried to utilize this approach in my Dockerfile:

FROM node:carbon
...
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
ENV PATH="/home/node/.npm-global:${PATH}"
...
RUN npm install -g nodemon
...
CMD ["nodemon", "server.js"]
USER node

But when I try to start the container I get:

ERROR: for my_project_node_1  Cannot start service my_project_node:
OCI runtime create failed: container_linux.go:296: 
starting container process caused "exec: \"nodemon\": 
executable file not found in $PATH": unknown

ERROR: for my_project_node  Cannot start service my_project_node: 
OCI runtime create failed: container_linux.go:296: 
starting container process caused "exec: \"nodemon\": 
executable file not found in $PATH": unknown

I just don't understand what I do incorrectly..

How to set PATH environment variable in a Dockerfile I get from here https://stackoverflow.com/a/38742545/202550

starikovs
  • 3,240
  • 4
  • 28
  • 33
  • I'm not 100% sure on this as I couldnt find propper documentation on it, but do you need the PATH to be set? Does npm not sort it out using hte NPMCONFIG_PREFIX alone? – Pandelis Jan 31 '18 at 14:04
  • Nope, I tried without setting the PATH variable, the same result. – starikovs Jan 31 '18 at 16:21

0 Answers0