简体   繁体   English

npm create-react-app myapp 给出错误命令失败:create-react-app spawn EPERM

[英]npm create-react-app myapp gives error Command failed: create-react-app spawn EPERM

Months ago, on my home PC I installed nodejs, react, etc., and got various tutorial sample projects working.几个月前,我在家用 PC 上安装了 nodejs、react 等,并获得了各种教程示例项目。 Now I'm remoting to my up-to-date Windows 10 work PC to install everything.现在我正在远程连接到我最新的 Windows 10 工作 PC 以安装所有内容。

I've done the setup steps from the Traversy Media React Crash Course tutorial (5 stars), also just now, to double-check, watched the 1-minute video and reviewed the simple instructions at https://www.techomoro.com/how-to-install-and-setup-a-react-app-on-windows-10/ .我已经完成了 Traversy Media React Crash Course 教程(5 星)中的设置步骤,也是刚刚,仔细检查,观看了 1 分钟的视频并查看了https://www.techomoro.com上的简单说明/how-to-install-and-setup-a-react-app-on-windows-10/

So I've installed nodejs from https://nodejs.org/en and downloaded react-0.14.3.zip (but there's not an.msi installer, just a build folder and an examples folder… am I forgetting or missing something?)所以我从https://nodejs.org/en安装了 nodejs 并下载了 react-0.14.3.zip(但是没有 .msi 安装程序,只有一个构建文件夹和一个示例文件夹……我是不是忘记或遗漏了什么?)

Installed create-react-app globally: PS C:\users\molin\dev\myapp> npm install -g create-react-app …which spewed out… C:\Users\molin\AppData\Roaming\npm\create-react-app -> C:\Users\molin\AppData\Roaming\npm\node_modules\create-react-app\index.js [+ sign] create-react-app@4.0.1 updated 1 package in 7.639s全局安装的 create-react-app: PS C:\users\molin\dev\myapp> npm install -g create-react-app …喷出… C:\Users\molin\AppData\Roaming\npm\create-react -app -> C:\Users\molin\AppData\Roaming\npm\node_modules\create-react-app\index.js [+ sign] create-react-app@4.0.1 updated 1 package in 7.639s

When I'm a level above the myapp folder and do either of these: npx create-react-app.当我在 myapp 文件夹之上的级别并执行以下任一操作时:npx create-react-app。 npx create-react-app myapp …or if I'm in the myapp folder and do either of these: npx create-react-app myapp npx create-react-app. npx create-react-app myapp ...或者如果我在 myapp 文件夹中并执行以下任一操作:npx create-react-app myapp npx create-react-app。

… I get the error: Command failed: create-react-app spawn EPERM …我收到错误:命令失败:create-react-app spawn EPERM

Per a suggestion on a board, I ran this and retried, but no joy.根据板上的建议,我运行并重试,但没有任何乐趣。 npm cache clean --force I even rebooted and tried again. npm 缓存清理 --force 我什至重新启动并再次尝试。

No events show on the Window Event viewer. Window 事件查看器上没有显示任何事件。 Is this a permissions error on my work PC?这是我工作电脑上的权限错误吗?

Thank you for any advice!谢谢你的任何建议!

Reinstall react app globally全局重新安装 react 应用
npm i -g create-react-app

Recreate your app - create-react-app重新创建您的应用程序 - create-react-app
(maybe this will help) (也许这会有所帮助)

Got it working, jeez.得到它的工作,天哪。 In case this helps someone...万一这对某人有帮助...

  • Opened VS Code;打开VS代码; Undoubtedly didn't need to do this, but did File >毫无疑问,不需要这样做,但文件 >
  • Open the folder myapp (which contained nothing yet)打开文件夹 myapp(其中不包含任何内容)
  • Opened the VS Code terminal, cd.. to go a level up above the myapp folder;打开 VS Code 终端,cd.. 到 myapp 文件夹上方的 go ;
  • npx create-react-app myappNEW, IOW a folder that didn't exist yet. npx create-react-app myappNEW,IOW 一个尚不存在的文件夹。

If I did that last command for "myapp", it gave the spawn error.如果我对“myapp”执行了最后一个命令,则会出现生成错误。

I had typed the following, but then tried it and it failed, so this is not the case: Conceivably, when doing this from the powershell, I didn't try npx (rather than npm) with a non-existent folder name.我输入了以下内容,但随后尝试失败,所以情况并非如此:可以想象,当从 powershell 执行此操作时,我没有尝试使用不存在的文件夹名称的 npx(而不是 npm)。

No need for any other package install in your PC or System.无需在您的 PC 或系统中安装任何其他 package。

  1. Install node安装节点

npm i node npm i 节点

  1. create project创建项目

npx create-react-app project_name --template all npx create-react-app project_name --template all

Please try these commands on your terminal:-请在您的终端上尝试这些命令:-


npx create-react-app my-app

cd my-app

npm start

I hope this will help you out.我希望这会帮助你。

You can also visit https://reactjs.org/docs/create-a-new-react-app.html for your reference.您也可以访问https://reactjs.org/docs/create-a-new-react-app.html供您参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM