Npm start command doesn't work

After restarting my visual studio code nmp start command stopped working.It is showing the following errors.

$ npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\user\Desktop\project\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open ‘C:\Users\user\Desktop\project\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\Roaming\npm-cache_logs\2021-03-01T13_40_24_218Z-debug.log.
How can I fix the problem?

1 Like

Hello!

The error says it doesn’t find the package.json file, is it in your project?

1 Like

yes.It’s in my project.

1 Like

Did you solve the problem? I’m asking because you marked my last post as the solution :stuck_out_tongue:.

1 Like

No I didn’t find a solution.

1 Like

I tried to solve it in many ways.Even I uninstalled my node server.But nothing worked.

2 Likes

Ok then… could you show me a picture of your project structure? Can you execute NPM from the command line (CMD or PowerShell)? Like:

cd C:\Users\user\Desktop\project
npm start
1 Like

What is the solution of this ?

1 Like

Do the following:

  1. Press and hold the Shift key, then right click on an empty space inside your project (inside the folder, not inside VSCode).
  2. Click on Open command window here.
  3. Run the following: npm start.

If it works, then there’s a problem with how you configured your VSCode project.

1 Like

No,it doesn’t work.

1 Like

Yes, it did work :stuck_out_tongue:. That means it’s a problem with how you setup VSCode.

You have two options now:

  • Continue using the console (PowerShell) or
  • Fix the project setup.

It’s hard to help you with the second option since only you know how you initially setup the project. What did you initially do to run NPM inside Visual Studio Code?

Try to setup your project again (repeat the same steps and make a backup first).

1 Like