You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WSL环境下运行npx create-react-app报错求助

无法在WSL路径下运行npx create-react-app,出现UNC路径不支持与权限错误

我正在测试npx create-react-app是否可用,尝试多种方法后仍无法正常运行,推测问题可能和路径有关,但不确定具体原因,也没有解决思路。

最初执行npx create-react-app my-app时遇到Node版本过低的错误,更新Node后路径出现异常,我卸载并重新安装了Node,之后脚本提示安装成功,但实际执行时出现以下错误:

'\\wsl.localhost\Ubuntu-22.04\home\pat\sei\testing'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
node:fs:1395
  handleErrorFromBinding(ctx);
  ^

Error: EPERM: operation not permitted, mkdir 'my-app'
    at Object.mkdirSync (node:fs:1395:3)
    at module.exports.makeDirSync (C:\Users\Patrick\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\fs-extra\lib\mkdirs\make-dir.js:23:13)
    at createApp (C:\Users\Patrick\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:257:6)
    at C:\Users\Patrick\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:223:9
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errno: -4048,
  syscall: 'mkdir',
  code: 'EPERM',
  path: 'my-app'
}

Node.js v18.12.1

后续尝试执行npx create-react-app ./,又出现如下错误:

'\\wsl.localhost\Ubuntu-22.04\home\pat\sei\testing'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
Cannot create a project named \"Windows\" because of npm naming restrictions:

  * name can no longer contain capital letters

Please choose a different project name.

目前仍无法解决问题,希望得到帮助。

内容的提问来源于stack exchange,提问作者Patrick Mangan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 15:10:39