I am trying to share my local space with my docker container with Volume. BTW I am working on a nest app. The problem is whenever I am trying to enable the volume feature I am getting some weird error!
api_1 | npm ERR! code ENOENT
api_1 | npm ERR! syscall open
api_1 | npm ERR! path /usr/app/package.json
api_1 | npm ERR! errno -2
api_1 | npm ERR! enoent ENOENT: no such file or directory, open '/usr/app/package.json'
api_1 | npm ERR! enoent This is related to npm not being able to find a file.
api_1 | npm ERR! enoent
api_1 |
api_1 | npm ERR! A complete log of this run can be found in:
api_1 | npm ERR! /root/.npm/_logs/2020-05-24T19_44_36_593Z-debug.log
I am calling this weird because I haven't found any proper explanation about this error. although these links are quite close to my problem prob1, prob2
My docker file -
# Download base image
FROM node:alpine
# Define Base Directory
WORKDIR /usr/app
# Copy and restore packages
COPY ./package*.json ./
RUN npm install
# Copy all other directories
COPY ./ ./
# Setup base command
CMD [ "npm", "run", "start" ]
and my docker-compose file
version: '3'
services:
api:
build:
context: .
dockerfile: Dockerfile.dev
ports :
- "4200:4500"
volumes:
- /usr/app/node_modules
- /:/usr/app
as far as I can understand whenever I tried to use volume means /:/usr/app
replacing docker directory with local project directory. But on my project root directory, I have package.json
file. Also in my docker file, I have copied package.json
file.
can anyone help me with this issue? I am new with docker, I am doing this just for learning purpose.