简体   繁体   English

当我尝试创建一个反应应用程序时,它会出错

[英]when I try to create a react app it gives an error

first thing I run this command to install the create-react-app 我首先运行此命令来安装create-react-app

npm install -g create-react-app

when It finishes everything and then I run the create-react-app name command it gives a weird error 当它完成所有内容然后我运行create-react-app name命令时会出现一个奇怪的错误

C:\Users\Mostafa Ossama\Desktop>create-react-app swag-shop-web

Creating a new React app in C:\Users\Mostafa Ossama\Desktop\swag-shop-web.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

events.js:137
      throw er; // Unhandled 'error' event
      ^

Error: spawn C:\Users\Mostafa Ossama\AppData\Roaming\npm\node_modules\create-react-app ENOENT
    at _errnoException (util.js:1003:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19)
    at onErrorNT (internal/child_process.js:389:16)
    at process._tickCallback (internal/process/next_tick.js:152:19)
    at Function.Module.runMain (module.js:703:11)
    at startup (bootstrap_node.js:190:16)
    at bootstrap_node.js:662:3

is It a problem in the PATH ??(maybe but I don't think so because I run nodemon normally) 它是PATH中的一个问题吗?(也许但我不这么认为,因为我正常运行nodemon

I tried to uninstall and install create-react-app again , but I had the same problem. 我试图再次卸载并安装create-react-app ,但我遇到了同样的问题。

Thanks in advance to everyone.. 在此先感谢大家..

some useful info 一些有用的信息

I'm using windows 10 pro 64-bit version: 1709 我正在使用Windows 10专业版64位版本:1709

node version: v9.5.0 节点版本:v9.5.0

npm version: 5.7.1 npm版本:5.7.1

I use both powershell and the git bash (most of the time git-bash) 我使用powershell和git bash(大部分时间都是git-bash)

powershell version: 5.1.16299.248 powershell版本:5.1.16299.248

git version: 2.15.1.windows.2 git版本:2.15.1.windows.2

{ npm: '5.7.1',
  ares: '1.13.0',
  cldr: '32.0',
  http_parser: '2.7.0',
  icu: '60.1',
  modules: '59',
  napi: '2',
  nghttp2: '1.29.0',
  node: '9.5.0',
  openssl: '1.0.2n',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.1',
  v8: '6.2.414.46-node.18',
  zlib: '1.2.11' }

The same issue that I resolve myself by completely removing and reinstalling the nodejs . 我通过完全删除并重新安装nodejs解决自己的nodejs from logs, it looks like that it's definitely a problem with how node is set up on your computer, and you'd need to fix that first. 从日志来看,它看起来肯定是你的计算机上如何设置node的问题,你需要先修复它。

I would recommend you to uninstall node and npm completely and reinstall it again. 我建议你完全卸载nodenpm然后重新安装。

  • Remove %PATH% environment variable references of nodejs and npm if any. 删除nodejsnpm %PATH% environment variable引用(如果有)。

  • Uninstall node and npm from the Programs & Features with the windows uninstaller. 使用Windows卸载Programs & Features从“ Programs & Features卸载nodenpm

  • Reboot the system to kill all the existing and still running processes of node and npm after uninstallation. 重新启动系统以在卸载后npm所有现有且仍在运行的nodenpm进程。

  • To newly install node and npm you can refer this documentation: http://blog.teamtreehouse.com/install-node-js-npm-windows 要新安装nodenpm ,可以参考以下文档: http//blog.teamtreehouse.com/install-node-js-npm-windows

I would also recommend using node with nvm . 我还建议使用nvm node for same you can refer below documentation: https://medium.com/appseed-io/how-to-run-multiple-versions-of-node-js-with-nvm-for-windows-ffbe5c7a2b47 同样你可以参考下面的文档: https//medium.com/appseed-io/how-to-run-multiple-versions-of-node-js-with-nvm-for-windows-ffbe5c7a2b47

To install your required package and work around with it easily you can refer below documentation: https://github.com/facebook/create-react-app 要安装所需的软件包并轻松使用它,您可以参考以下文档: https//github.com/facebook/create-react-app

Hope this is helpful to you! 希望这对你有所帮助!

我联系了npm支持,但没有任何工作,我只是重新安装我的操作系统,它工作

暂无
暂无

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

相关问题 Npm 尝试创建反应应用程序时出错 - Npm Error when I try to create the react app 每当我尝试创建新的反应应用程序或尝试启动现有的反应应用程序时出现错误 - Getting error whenever I try to create new react app or try to start existing react app 当我尝试创建 react 项目时出现错误 - When i try to create react project i get error 当我尝试使用npm start命令运行React App时出错 - Error when I try run a React App with npm start command 当我尝试导入本地模块时,React给出错误:不支持的错误 - React gives Error: not supported error when I try and import local module 当我尝试创建 React 应用程序时,出现“未提供模板,这可能是因为您使用的是过时版本的 create-react-app”错误 - when i try to create react app ,i get " template was not provided ,This is likely because you're using an outdated version of create-react-app " Error 当我使用 npm 创建反应应用程序时,我收到此错误 - when I use npm to create react app ,I get this error 当我尝试使用 npm 运行反应应用程序时出现此错误? - I am getting this error when I try to run react app with npm? 每当我尝试创建一个反应应用程序时,它都会显示以下错误,我尝试了日志文件也显示了代理错误 - whenever I try to create a react app , it shows the following error, I tried the log file also it shows the proxy error 为什么我在安装 react 应用程序时,它给了我这个错误? - Why when im installing react app, it gives me this error?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM