0

node.js gives me the following warning:

npm WARN saveError ENOENT: no such file or directory, open '/usr/myapp/package.json'

npm WARN enoent ENOENT: no such file or directory, open '/usr/myapp/package.json'

even though the package.json file is around in that directory. I didn't have problems with this before but today it just appeared out of nowhere. I deleted my node_modules folder and tried to reinstall the modules but the same warning keeps popping up. Does anyone know a quick fix to this? I'm using version 5.6.0 and my app is running in a Docker container.

bobdolan
  • 563
  • 3
  • 9
  • 21
  • are you sure package.json is copied inside docker container? .. Can you attach the DockerFile and .dockerignore file in the question? Are you running npm install inside docker? – arunp9294 Jul 16 '18 at 09:45
  • @arunp9294 Yes, I'm running npm install inside the docker container and it always worked before. The package.json is inside the docker container, there's also a package-lock.json and I don't get how Node doesn't recognize the file... – bobdolan Jul 16 '18 at 09:49
  • are you using any frame work like Express , sails , hapi or simple node js application? – arunp9294 Jul 16 '18 at 09:57
  • I do use express but other than that just simple node js applications – bobdolan Jul 16 '18 at 10:01
  • https://stackoverflow.com/questions/9484829/npm-cant-find-package-json check this kinda feels same – arunp9294 Jul 16 '18 at 10:03

1 Answers1

0

In that same directory, create a file called package.json, and then paste this to package.json:

{}

your program should work now

Jake
  • 97
  • 1
  • 9