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
相关产品推荐
相关产品推荐

