Npm ERR! enoent ENOENT: no such file or directory (only happens on 1 computer!)

I’m using a Windows 10 machine for development at home, a Windows 10 machine for development at work, and an Ubuntu 1604 server for production…

I have a Dockerfile for a Node app…

FROM node:10

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
COPY package*.json ./

RUN npm install

RUN npm install -g nodemon

# Bundle app source into container
COPY . .


a docker-compose.yml file…

version: "2"
    container_name: database
    build: .
      - mongo
    container_name: mongo
    image: mongo:4

and a file for running in development…

version: "2"
    restart: always
      - .:/usr/src/app
      - "8080:8080"
    command: ["npm", "start"]
      - "27017:27017"

When I run “docker-compose -f docker-compose.yml -f up” it always works fine on my Windows 10 development machine at home, but when I run the same command on my Windows 10 machine at work it always throws the error…

database | npm ERR! path /usr/src/app/package.json
database | npm ERR! code ENOENT
database | npm ERR! errno -2
database | npm ERR! syscall open
database | npm ERR! enoent ENOENT: no such file or directory, open '/usr/src/app/package.json'
database | npm ERR! enoent This is related to npm not being able to find a file.
database | npm ERR! enoent
database |
database | npm ERR! A complete log of this run can be found in:
database | npm ERR!     /root/.npm/_logs/2019-01-17T16_28_12_239Z-debug.log

I’m using the exact same code, both on a windows 10 OS! I started using Docker specifically to avoid issues like this and its driving me crazy.

Does anyone know what may be happening???

Any update on this? I’m having the same trouble

please somebody update this i have exactly same issue and trap in that for 3 days please if somebody knows
to solve that let me know
@ xandervolt
@ ccoronado

Did you solve the problem?

I have the same problem. Without Docker si work, but when I try run docker container I take the same error.

Anyone found a solution for this? Started happening to me few days ago. Also similar environment with a node:12 image + webpack

1 Like