I am currently trying to install my NPM packages with Docker however, it's unable to do this for local packages? How do I fix this?
DockerFile:
FROM node:12
WORKDIR /var/api
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3010
CMD ["npm", "start"]
package.json
"dependencies": {
"@hapi/joi": "^16.1.7",
"@polka/send-type": "^0.5.2",
"polka": "^0.5.2",
"body-parser": "^1.19.0",
"axios": "^0.19.0",
"core": "file:../core",
"compression": "^1.7.4",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"ua-parser-js": "^0.7.21",
"moment": "^2.24.0",
"moment-duration-format": "^2.3.2",
"node-schedule": "^1.3.2"
},
Thanks.
COPY package*.json ./
RUN npm install
The problem is with those two lines, you are trying to install "core": "file:../core"
but you never copied those dependencies to your image, so copy those dependencies along with the package.json
and you will be good
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With