Skip to content

[BUG] ENOENT: no such file or directory, lstat 'C:\Users\Liu.D.H\AppData\Roaming\npm' while execute npm install #8611

@liudonghua123

Description

@liudonghua123

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

I tried to install some package via npm, but it failed with ENOENT error.

C:\Users\Liu.D.H>npm install -g @anthropic-ai/claude-code @musistudio/claude-code-router --verbose
npm verbose cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
npm info using npm@11.6.0
npm info using node@v24.9.0
npm verbose title npm install @anthropic-ai/claude-code @musistudio/claude-code-router
npm verbose argv "install" "--global" "@anthropic-ai/claude-code" "@musistudio/claude-code-router" "--loglevel" "verbose"
npm verbose logfile logs-max:10 dir:C:\Users\Liu.D.H\AppData\Local\npm-cache\_logs\2025-09-29T23_38_17_096Z-
npm verbose logfile C:\Users\Liu.D.H\AppData\Local\npm-cache\_logs\2025-09-29T23_38_17_096Z-debug-0.log
npm verbose stack Error: ENOENT: no such file or directory, lstat 'C:\Users\Liu.D.H\AppData\Roaming\npm'
npm verbose stack     at async lstat (node:internal/fs/promises:1031:18)
npm verbose stack     at async #rootNodeFromPackage (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:378:18)
npm verbose stack     at async #globalRootNode (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:358:18)
npm verbose stack     at async #initTree (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:268:14)
npm verbose stack     at async Arborist.buildIdealTree (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:179:7)
npm verbose stack     at async Arborist.reify (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:126:5)
npm verbose stack     at async Install.exec (C:\Program Files\nodejs\node_modules\npm\lib\commands\install.js:150:5)
npm verbose stack     at async Npm.exec (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:208:9)
npm verbose stack     at async module.exports (C:\Program Files\nodejs\node_modules\npm\lib\cli\entry.js:67:5)
npm error code ENOENT
npm error syscall lstat
npm error path C:\Users\Liu.D.H\AppData\Roaming\npm
npm error errno -4058
npm error enoent ENOENT: no such file or directory, lstat 'C:\Users\Liu.D.H\AppData\Roaming\npm'
npm error enoent This is related to npm not being able to find a file.
npm error enoent
npm verbose cwd C:\Users\Liu.D.H
npm verbose os Windows_NT 10.0.26200
npm verbose node v24.9.0
npm verbose npm  v11.6.0
npm verbose exit -4058
npm verbose code -4058
npm error A complete log of this run can be found in: C:\Users\Liu.D.H\AppData\Local\npm-cache\_logs\2025-09-29T23_38_17_096Z-debug-0.log

C:\Users\Liu.D.H>

And I tested lstat and mkdir in repl of node.

C:\Users\Liu.D.H>node
Welcome to Node.js v24.9.0.
Type ".help" for more information.
> const {
|   lstat,
|   mkdir,
|   rm,
|   symlink,
| } = require('node:fs/promises')
undefined
>
> await lstat("C:/Users/Liu.D.H/AppData/Roaming")
Stats {
  dev: 2352162001,
  mode: 16822,
  nlink: 1,
  uid: 0,
  gid: 0,
  rdev: 0,
  blksize: 4096,
  ino: 1688849860788744,
  size: 0,
  blocks: 0,
  atimeMs: 1759189261345.5803,
  mtimeMs: 1711956883494.5923,
  ctimeMs: 1759185634129.2036,
  birthtimeMs: 1759185634049.553
}
> await mkdir("C:/Users/Liu.D.H/AppData/Roaming/npm",{ recursive: true})
'\\\\?\\C:\\Users\\Liu.D.H\\AppData\\Roaming\\npm'
> await lstat("C:/Users/Liu.D.H/AppData/Roaming/npm")
Uncaught:
Error: ENOENT: no such file or directory, lstat 'C:\Users\Liu.D.H\AppData\Roaming\npm'
    at async lstat (node:internal/fs/promises:1031:18)
    at async REPL44:1:33 {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'lstat',
  path: 'C:\\Users\\Liu.D.H\\AppData\\Roaming\\npm'
}
>
> await mkdir("C:/Users/Liu.D.H/AppData/Roaming/npm",{ recursive: true})
Uncaught:
Error: ENOENT: no such file or directory, mkdir 'C:\Users\Liu.D.H\AppData\Roaming\npm'
    at async mkdir (node:internal/fs/promises:861:10)
    at async REPL47:1:33 {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'mkdir',
  path: 'C:\\Users\\Liu.D.H\\AppData\\Roaming\\npm'
}
> await mkdir("C:/Users/Liu.D.H/AppData/Roaming/npm")
Uncaught:
Error: EEXIST: file already exists, mkdir 'C:\Users\Liu.D.H\AppData\Roaming\npm'
    at async mkdir (node:internal/fs/promises:861:10)
    at async REPL48:1:33 {
  errno: -4075,
  code: 'EEXIST',
  syscall: 'mkdir',
  path: 'C:\\Users\\Liu.D.H\\AppData\\Roaming\\npm'
}
>

Expected Behavior

command npm install successfully.

Steps To Reproduce

  1. Run npm install -g @anthropic-ai/claude-code @musistudio/claude-code-router --verbose

Environment

  • npm: v11.6.0
  • Node.js: v24.9.0
  • OS Name: Microsoft Windows [Version 10.0.26200.6584]
  • System Model Name:
  • npm config:
C:\Users\Liu.D.H>npm config ls
; "builtin" config from C:\Program Files\nodejs\node_modules\npm\npmrc

prefix = "C:\\Users\\Liu.D.H\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v24.9.0
; npm local prefix = C:\Users\Liu.D.H
; npm version = 11.6.0
; cwd = C:\Users\Liu.D.H
; HOME = C:\Users\Liu.D.H
; Run `npm config ls -l` to show all defaults.

C:\Users\Liu.D.H>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions