由于某种原因我无法创建反应项目

问题描述 投票:0回答:1

当我运行

npx create-react-app my-app
时,我得到:

npm ERR! code ENOENT
npm ERR! syscall spawn npm
npm ERR! path D:\ReactDemo
npm ERR! errno -4058
npm ERR! enoent spawn npm ENOENT
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\Mi PC\AppData\Local\npm-cache\_logs\2024-03-22T11_27_00_455Z-debug-0.log

我尝试:

  • 重新安装NodeJS

  • 运行:

    npm uninstall -g create-react-app && npm i -g npm@latest && npm cache clean -f

  • 清除系统临时文件夹并设置环境变量。

  • 清除npm缓存文件夹等

reactjs node.js npm create-react-app npx
1个回答
1
投票

更新NPM:

npm install npm@latest -g

清除缓存:

npm cache clean --force

仅全局重新安装:

npm uninstall -g create-react-app
npm uninstall create-react-app
npm install -g create-react-app

重新启动计算机并以管理员身份启动 CMD。那你可以试试:

npx create-react-app@latest my-app --use-npm

或者:

npx create-react-app my-app

或者:

create-react-app my-app
© www.soinside.com 2019 - 2024. All rights reserved.