npm ERR! enoent ENOENT: no such file or directory, chmod ‘/app/node_modules/node/bin/node.exe’

  docker, docker-compose, node.js, npm

I am running into the error message from the title. I am trying to run "docker-compose up" on my project and the Dockerfile in the frontend executes "RUN npm install". In there I keep running into this issue with my node installation. I installed node via nvm so the installation directory of the node executables actually differs from the expected path.

I have already been doing the following:

  • Changing the NVM_BIN variable in the .nvmrc file, but nvm still installs in the default directory.
  • reinstalling node / changing versions between latest and latest LTS
  • running "npm cache clean" (with and without "–force" flag)

So the real question is probably (but I am also open to other suggestions): How do I change the installation directory of NVM in WSL2 / How can I get Docker to look for the node installation in a different place?

Screenshot of CMD output

Source: Docker Questions

LEAVE A COMMENT