[Solved] npm ERR! code ENOENT npm ERR! syscall open

While I am trying to run my project with npm start command, then I am face the following error npm ERR! code ENOENT npm ERR! syscall open.

In this article, we will discuss about this npm ERR! code ENOENT npm ERR! syscall open error in ReactJs. And how to resolve the error all the possible solutions with examples.

How npm ERR! code ENOENT npm ERR! syscall open Error Occurs?

Most of the time you get this error while running your project with npm start command, looks like the below:

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /mnt/c/Users/pal/Desktop/dev/myApp/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/codecary/Desktop/dev/myApp/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

How to fix npm ERR! code ENOENT npm ERR! syscall open?

There are different ways to fix npm ERR! code ENOENT npm ERR! syscall open this error. Let us take a look at every solution.

  • How to fix npm ERR! code ENOENT npm ERR! syscall open?

To Solve npm ERR! code ENOENT npm ERR! syscall open Error you have to check package.json in your project folder. if not available then try to create package-lock.json with this name. After npm install in your project folder and run npm. Then your error will be gone.

  • npm ERR! code ENOENT npm ERR! syscall open

To Solve npm ERR! code ENOENT npm ERR! syscall open You have to run your npm start at the root directory where your package.json file is located with this command: cd project-name. Now, your error will be solved.

Solution 1: Adding package.json

First you have to add package-lock.json file in your project folder.

package-lock.json

and Then run npm install.

npm install

Then, run npm.

npm start

Now, your error will be solved.

Solution 2: Run this command

You have to run your npm start your root directory where your package.json file is located.

cd project-name

Then do

npm install
npm start

Now, your error will be gone.

Conclusion

In this article, we have discussed what causes the error and we have discussed ways to fix the error.

we hope this article has been informative. Thank you for reading. Kindly comment and let us know if you found it helpful.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Categories