Answer the question
In order to leave comments, you need to log in
Why does node.js complain about dev dependencies in a docker container?
here is my dockerfile
FROM node:14-slim
WORKDIR /class_attender
ENV NODE_ENV production
COPY package.json /class_attender/package.json
RUN npm install --production
COPY .env /class_attender/.env
COPY . /class_attender
CMD ["npm","start"]
EXPOSE 8080
BASE_URL=http://localhost:8080
MONGODB_URI=mongodb://localhost:27017/test1
SESSION_SECRET=Your Session Secret goes her
OPENSHIFT_NODEJS_PORT=8080
Error: Cannot find module 'morgan'
Require stack:
- /class_attender/app.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
at Function.Module._load (internal/modules/cjs/loader.js:730:27)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/class_attender/app.js:5:16)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/class_attender/app.js' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question