简体   繁体   中英

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

first thing I run this command to install the 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

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)

I tried to uninstall and install create-react-app again , but I had the same problem.

Thanks in advance to everyone..

some useful info

I'm using windows 10 pro 64-bit version: 1709

node version: v9.5.0

npm version: 5.7.1

I use both powershell and the git bash (most of the time git-bash)

powershell version: 5.1.16299.248

git version: 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 . 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.

I would recommend you to uninstall node and npm completely and reinstall it again.

  • Remove %PATH% environment variable references of nodejs and npm if any.

  • Uninstall node and npm from the Programs & Features with the windows uninstaller.

  • Reboot the system to kill all the existing and still running processes of node and npm after uninstallation.

  • To newly install node and npm you can refer this documentation: http://blog.teamtreehouse.com/install-node-js-npm-windows

I would also recommend using node with nvm . 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

To install your required package and work around with it easily you can refer below documentation: https://github.com/facebook/create-react-app

Hope this is helpful to you!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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