从终端运行npx create-react-app my-app时出错

时间:2019-12-19 18:46:28

标签: reactjs create-react-app

我正在尝试为React建立一个开发环境。我安装了Node js,并在终端中运行了npx create-react-app my-app,并得到了以下结果:

npx: installed 91 in 5.088s
Creating a new React app in /Users/macbook/my-app.
/bin/sh: npm: command not found
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
events.js:187
throw er; // Unhandled 'error' event
^
Error: spawn npm ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
   errno: 'ENOENT',
   code: 'ENOENT',
   syscall: 'spawn npm',
   path: 'npm',
   spawnargs: [
     'install',
     '--save',
     '--save-exact',
     '--loglevel',
     'error',
     'react',
     'react-dom',
     'react-scripts@0.9.x'
   ]
}

0 个答案:

没有答案