Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: ENOENT: no such file or directory, stat 'C:\Users\username\Documents\My Music'

I am trying to run this react app: https://github.com/JackHeTech/multiplayer-chess-game

It works when I download the repo and do npm install and then npm start.

But when I try to make the project myself using create-react-app with these steps:

npx create-react-app frontend
*copy the required files from repo to frontend folder*
npm install <p1> <p2> ...
npm start

That doesn't work and shows these errors:

Compiling...
C:\Users\username\Documents\Projects\chess_server\frontend\node_modules\react-scripts\scripts\start.js:19
  throw err;
  ^

[Error: ENOENT: no such file or directory, stat 'C:\Users\username\Documents\My Music'] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'stat',
  path: 'C:\\Users\\username\\Documents\\My Music'
}
PS C:\Users\username\Documents\Projects\chess_server\frontend> 

Why is it pointing to 'C:\Users\username\Documents\My Music'? I have not used that path anywhere in my files.

Basically I am trying to recreate the project from the repo on my own. But it's giving me the error given above.

like image 678
Het Avatar asked Dec 28 '25 16:12

Het


2 Answers

I ran into the same error, and the problem was that i was importing something without actually installing the npm package. In my case, it was react-router-dom. Double check that you've actually installed all your dependencies that you've used in your code with npm install --save <your dependency>

like image 76
Jay Pillai Avatar answered Dec 30 '25 04:12

Jay Pillai


It is indeed odd that it references my music. Did try npm install inside the project folder? If so, try deleting package.json and running npm install again.

EDIT
I was also plagued by this error, and after trying all the other answers, magically found the following solution:

Delete package-lock.json and the node_modules folder, then run npm install again.

If that doesn't work, try running these in order:

npm install
npm cache clean --force
npm install -g npm
npm install

and then re-deleting the above files and re-running npm install.

Worked for me!

like image 33
Azpil Avatar answered Dec 30 '25 05:12

Azpil