0

I'm going through an introductory Docker course, and it's instructing me to create a docker file where I'm encountering the error

Error: Cannot find module '/app/NPM'

when I run the command:

docker run -it -p 3000:3000 3ce0a937488d

The command to install the app on my local system is:

npx create-react-app frontend

This is Dockerfile.dev:

WORKDIR '/app'
COPY package.json .
RUN npm install
COPY . .
CMD ["NPM", "RUN", "START"]

This is the build command:

docker build -f ./Dockerfile.dev .

The full error message from the running the image is this:

node:internal/modules/cjs/loader:922
  throw err;
  ^

Error: Cannot find module '/app/NPM'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:15)
    at Function.Module._load (node:internal/modules/cjs/loader:763:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Any ideas?

Jack BeNimble
  • 35,733
  • 41
  • 130
  • 213
  • Could you show what's there in the docker file ? – Ashwin R Nov 20 '20 at 03:38
  • Can you explain the question? There's no running process. so I can't run to attach to it. – Jack BeNimble Nov 20 '20 at 03:52
  • I had a very similar issue. Removing the entire node_modules folder and re-installing worked for me – Ashok Nov 20 '20 at 09:10
  • 2
    Linux systems are generally case-sensitive, and the all-caps `NPM` doesn't look right (though it also wouldn't produce that error). Does lowercase `CMD ["npm", "run", "start"]` work better? – David Maze Nov 20 '20 at 11:43
  • @DavidMaze you're exactly right. I somehow lost track of the fact those are just Linux commands and was looking at docker-related stuff. – Jack BeNimble Nov 20 '20 at 17:55

0 Answers0