Krizsa
Krizsa

Reputation: 47

My npm run dev can't find the packages.json file

So I'm running npm run dev at this adress: C:\Users\palyi\Documents\nextJS

And I get the following:

npm ERR! code ENOENT

npm ERR! syscall open

npm ERR! path C:\Users\palyi\package.json

npm ERR! errno -4058

npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\palyi\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\palyi\AppData\Roaming\npm-cache_logs\2021-12-04T17_46_26_819Z-debug.log

I don't get it why it is looking for the packages.json file like this: C:\Users\palyi\package.json

What am I doing wrong?

Upvotes: 1

Views: 1420

Answers (2)

Herahadi An
Herahadi An

Reputation: 346

You are running npm run dev at the wrong directory. Change directory to your project foder first

cd C:\Users\palyi\Documents\nextJS
npm run dev

Upvotes: 1

sanepete
sanepete

Reputation: 1120

I get this a lot.

It usually goes away after I try npm run build, then npm start.

If not, there's probably something wrong with your code.

Upvotes: 0

Related Questions