I got an error in logs after running this command:
docker run -d -p 3000:80 --name feedback-app -v feedback:/app/feedback -v "/WorkSpace/d/data-volumes-03-adj-node-code:/app" -v /app/node_modules feedback-node:volumes
The error is:
internal/modules/cjs/loader.js:892 throw err; ^
Error: Cannot find module '/app/server.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15) at Function.Module._load (internal/modules/cjs/loader.js:745:27) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) at internal/main/run_main_module.js:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }
How can I solve this problem?
My Dockerfile:
FROM node:14
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
EXPOSE 80
# VOLUME ["/app/feedback"]
CMD ["node", "server.js"]
The problem is that you are not specifying the full path to your project directory in the -v "/WorkSpace/d/data-volumes-03-adj-node-code:/app"
.
You should do -v "c:/WorkSpace/d/data-volumes-03-adj-node-code:/app"
instead