Skip to content

[BUG] npx fails with ENOENT: no such file or directory, lstat 'C:\Users\Stefnotch\AppData\Roaming\npm' #7089

Closed
@stefnotch

Description

@stefnotch

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

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

  1. On a Windows machine, install Node.js. I personally installed it with winget.
  2. Run npx create-react-app some-name
  3. If it the error happens, then yay. If not, then go to step 4.
  4. Go to %appdata% (C:\Users\USERNAME\AppData\Roaming)
  5. Delete the npm folder.
  6. Run npx create-react-app some-name again
  7. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions