0

npm ERR! code ENOENT

npm ERR! syscall open

npm ERR! path /Users/giovanylopes/bootcamp-projects/react-nodejs-example/package.json

npm ERR! errno -2

npm ERR! enoent ENOENT: no such file or directory, open '/Users/giovanylopes/bootcamp-projects/react-nodejs-example/package.json'

npm ERR! enoent This is related to npm not being able to find a file.

npm ERR! enoent

npm ERR! A complete log of this run can be found in:

npm ERR! /Users/giovanylopes/.npm/_logs/2022-11-18T14_26_47_519Z-debug-0.log

I was expecting to install all the dependencies that are defined in the package.json file

2 Answers 2

0

Most probably you don't have a package.json file in /Users/giovanylopes/bootcamp-projects/react-nodejs-example/ directory.

5
  • I did ls command and got this : Dockerfile api my-app package-lock.json
    – Gio
    Commented Nov 18, 2022 at 14:42
  • So as you can see there is no package.json file in your directory. You only can run npm install in a directory where you have packge.json. Commented Nov 18, 2022 at 14:47
  • I see okay... sorry I'm a complete newbie how do I do that?
    – Gio
    Commented Nov 18, 2022 at 14:48
  • I don't understand what you are trying to do. Are you trying to run a nodejs API? Then look inside your api directory. You might have a package.json file there. Commented Nov 18, 2022 at 14:51
  • I cd'ed into api and tried npm install and it installed the dependencies. So I think it worked!
    – Gio
    Commented Nov 18, 2022 at 14:58
0

The part of the error that you have posted to focus on is the following piece:

no such file or directory, open '/Users/giovanylopes/bootcamp-projects/react-nodejs-example/package.json'

It can't find your package.json file at the location it has listed. Take a look at that location and make sure that you have a package.json file there.

3
  • I did ls command and got this : Dockerfile api my-app package-lock.json
    – Gio
    Commented Nov 18, 2022 at 14:41
  • Use the full path to make sure: ls /Users/giovanylopes/bootcamp-projects/react-nodejs-example/package.json Commented Nov 18, 2022 at 14:50
  • ls: /Users/giovanylopes/bootcamp-projects/react-nodejs-example/package.json: No such file or directory
    – Gio
    Commented Nov 18, 2022 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.