Description
Fixed in #7640 , update to a new version of npm!
This issue has been fixed. Please do npm install -g npm
or install a new Node.js
Old Behavior
When running npx create-react-app some-name
, then npx
throws an error message.
~> npx create-react-app some-name 12/17/23 10:49:32 AM
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\Stefnotch\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\Stefnotch\AppData\Roaming\npm'
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: C:\Users\Stefnotch\AppData\Local\npm-cache\_logs\2023-12-17T09_49_33_588Z-debug-0.log
This has been fixed in #7640 , update to a new version of npm!
Side note: I originally encountered it after creating a Threlte app, which includes the @threlte/gltf
tool. I ran npm run model-pipeline:run
in the Threlte app, which runs an npx command under the hood.
This is also a pretty widespread issue, as evidenced by
- [BUG] npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\userName\AppData\Roaming\npm' #6971
- https://stackoverflow.com/questions/77152589/cannot-find-npm-on-appdata-roaming
- https://stackoverflow.com/questions/76635661/npm-shows-an-error-enoent-no-such-file-or-directory-when-creating-a-react-pro
- https://stackoverflow.com/questions/76635661/npm-shows-an-error-enoent-no-such-file-or-directory-when-creating-a-react-pro
- https://www.youtube.com/watch?v=UwY6U7L10lg
- https://www.youtube.com/watch?v=mxyRDd-xKv4
- https://www.reddit.com/r/nextjs/comments/15x1w60/guys_getting_this_error_while_creating_a_next_app/
I suppose it'd be worthwhile to inform these people once it's fixed. I'll happily do so.
Expected Behavior
I expected npx create-react-app some-name
to work.
If the folder is missing, then npm
should automatically create it.
Steps To Reproduce
- On a Windows machine, install Node.js. I personally installed it with winget.
- Run
npx create-react-app some-name
- If it the error happens, then yay. If not, then go to step 4.
- Go to
%appdata%
(C:\Users\USERNAME\AppData\Roaming) - Delete the
npm
folder. - Run
npx create-react-app some-name
again - Error should happen
Apparently the npm
folder isn't being created by every installer or something. So we can manually reproduce the failure condition.
Environment
- npm: 10.2.3
- Node.js: 20.10.0
- OS Name: Windows 11
- System Model Name:
- npm config:
; "builtin" config from C:\Program Files\nodejs\node_modules\npm\npmrc
prefix = "C:\\Users\\Stefnotch\\AppData\\Roaming\\npm"
; node bin location = C:\Program Files\nodejs\node.exe
; node version = v20.10.0
; npm local prefix = C:\Users\Stefnotch
; npm version = 10.2.3
; cwd = C:\Users\Stefnotch
; HOME = C:\Users\Stefnotch
; Run `npm config ls -l` to show all defaults.