[英]create-react-app command failing at the very end, with errno -4058
I've been following a video course for full stack web development, and have gotten to the react part.我一直在关注全栈 web 开发的视频课程,并且已经进入反应部分。 The video course says that the create-react-app npm package can be used to readily and easily do an initial setup of a react app file hierarchy with all dependencies.
视频课程说 create-react-app npm package 可用于轻松轻松地对具有所有依赖项的 React 应用程序文件层次结构进行初始设置。
The method discussed in the course is to install the craete-react-app package globally using npm install -g create-react app
, which I did.课程中讨论的方法是使用
npm install -g create-react app
全局安装 craete-react-app package,我就是这样做的。 Then I should be creating the react app by using create-react-app my-project-name
.然后我应该使用
create-react-app my-project-name
。 When I launch this command, i get an output like this: Screenshot of error .当我启动这个命令时,我得到一个 output 像这样: Screenshot of error 。 In text:
在文本中:
Creating a new React app in E:\University\Learning material\Web Development\Udemy - The Complete Web Developer in 2021 Zero to Mastery 2021-4\19.
在 E:\University\Learning material\Web Development\Udemy 中创建一个新的 React 应用程序 - 2021 年从零到精通的完整 Web 开发人员 2021-4\19。 React.js, React Hooks, Redux (Hooks and Redux videos moved to end of course.)\exercise 1\robofriends.
React.js、React Hooks、Redux(Hooks 和 Redux 视频移至课程末尾。)\exercise 1\robofriends。
Installing packages.
安装软件包。 This might take a couple of minutes.
这可能需要几分钟。 Installing react, react-dom, and react-scripts with cra-template...
使用 cra-template 安装 react、react-dom 和 react-scripts...
npm ERR: code ENOENT npm ERR.
npm ERR:代码 ENOENT npm ERR。 syscall spawn C:\WINDOWS\system32\cmd.exe npm ERR.
系统调用产生 C:\WINDOWS\system32\cmd.exe npm 错误。 path E,\University\Learning material\Web Development\Udemy - The Complete Web Developer in 2021 Zero to Mastery 2021-4\19, React:js.
路径 E,\大学\学习资料\Web 开发\Udemy - 2021 年从零到精通的完整 Web 开发人员 2021-4\19,React:js。 React Hooks.
反应钩子。 Redux (Hooks and Redux videos moved to end of course!)\exercise 1\robofriends\node_modules\babel-runtime\node_modules\core-js npm ERR!
Redux(Hooks 和 Redux 视频已移至课程末尾!)\exercise 1\robofriends\node_modules\babel-runtime\node_modules\core-js ZBB30E85421B56DC8FZERR269! errno -4058 npm ERR!
错误号 -4058 npm 错误! enoent spawn C:\WINDOWS\system32\cmd.exe ENOENT npm ERR!
enoent spawn C:\WINDOWS\system32\cmd.exe ENOENT npm 错误! enoent This is related to npm not being able to find a file.
enoent 这与 npm 找不到文件有关。 npm ERR!
npm 错误! enoent
恩恩
npm ERR: A complete log of this run can be found in: npm ERR!
npm ERR:此运行的完整日志可在以下位置找到:npm ERR!
C:\Users\Amin\AppData\Local\npm-cache_logs\2021-05-02T16_25_06_903Z-debug.logC:\Users\Amin\AppData\Local\npm-cache_logs\2021-05-02T16_25_06_903Z-debug.log
Aborting installation.
中止安装。 npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
npm install --save --save-exact --loglevel 错误 react-dom react-scripts cra-template 失败。
Deleting generated file... package.json Deleting robofriends/ from E:\University\Learning material\Web Development\Udemy - The Complete Web Developer in 2021 Zero to Mastery 2021-4\19.
Deleting generated file... package.json Deleting robofriends/ from E:\University\Learning material\Web Development\Udemy - The Complete Web Developer in 2021 Zero to Mastery 2021-4\19. React.js, React Hooks, Redux (Hooks and Redux videos moved to end of course.)\exercise 1 Done.
React.js、React Hooks、Redux(Hooks 和 Redux 视频移至课程末尾。)\练习 1 完成。
The log file mentioned in the error has no extra information as far as I can see, only the same error message exactly replicated in a log file along with the preceding installation steps.据我所知,错误中提到的日志文件没有额外的信息,只有与前面的安装步骤完全复制在日志文件中的相同错误消息。 Just to be sure, I've made 3 pastebins to contain the gigantic log file here: Part 1 Part 2 Part 3
可以肯定的是,我在这里制作了 3 个粘贴箱来包含巨大的日志文件:第 1部分第 2部分第 3 部分
Methods I've tried to resolve the issue (And a combination of some):我尝试解决问题的方法(以及一些方法的组合):
npm cache clear -f
npm cache clear -f
npx create-react-app robofriends
to first install the package and then create the app folder right afternpx create-react-app robofriends
先安装 package 然后创建 app 文件夹Any help or guidance on the issue will be greatly appreciated.任何有关该问题的帮助或指导将不胜感激。 Thank you.
谢谢你。
Also, it might help to mention that I am using Windows 10 64bit.另外,提及我正在使用 Windows 10 64bit 可能会有所帮助。
It looks like there is a problem with your path (special characters etc.).看起来您的路径有问题(特殊字符等)。 If I recreate your exact path on my drive, I fail to create a react-app as well.
如果我在我的驱动器上重新创建你的确切路径,我也无法创建一个 react-app。 However, if you change your directory to another one and try again it should work!
但是,如果您将目录更改为另一个目录并重试,它应该可以工作!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.