Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript REST APIs with Express Getting to Know REST APIs A Simple API

josephpatrickpotot
josephpatrickpotot
18,010 Points

npm ERR! code ENOENT

I am getting the below error when I run npm install on the terminal

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\User\Desktop\Treehouse\rest_apis_express_projectfiles/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\User\Desktop\Treehouse\rest_apis_express_projectfiles\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!     C:\Users\User\AppData\Local\npm-cache\_logs\2022-02-16T07_58_13_615Z-debug-0.log

Can anyone advice on this?

2 Answers

josephpatrickpotot
josephpatrickpotot
18,010 Points

OK for anyone who may experience this problem. I found out the issue. You need first to change directory using CD command "cd S1V4_starter_files" so that you will get into the directory where the file is and run npm install from there.

There seems to be a lot of questions on the community not being answered the past few months now.

Marcio Gessoni
Marcio Gessoni
14,941 Points

In my case, my files are in this folder: C:\Users\me\OneDrive\Documents\Learn\rest_apis_express_projectfiles\S1V4_starter_files

So, Step 1: cd C:\Users\me\OneDrive\Documents\Learn\rest_apis_express_projectfiles\S1V4_starter_files Step 2: npm install