简体   繁体   English

当我在 cmd 中使用 npm start 启动我的反应应用程序时,我收到以下错误

[英]when I use npm start in cmd to start my react app iam getting the following error

This is the error I am getting when i do npm start after installing, Please help to resolve error, i tried reinstalling but didn't work.这是我在安装后执行 npm start 时遇到的错误,请帮助解决错误,我尝试重新安装但没有奏效。 i also tried reinstalling google chrome as suggested from somewhere.我还尝试按照某处的建议重新安装谷歌浏览器。

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

Error: spawn cmd ENOENT
←[90m    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:1
9)←[39m
←[90m    at onErrorNT (internal/child_process.js:456:16)←[39m
←[90m    at processTicksAndRejections (internal/process/task_queues.js:77:11)←[3
9m
Emitted 'error' event at:
←[90m    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:1
2)←[39m
←[90m    at onErrorNT (internal/child_process.js:456:16)←[39m
←[90m    at processTicksAndRejections (internal/process/task_queues.js:77:11)←[3
9m {
  errno: ←[32m'ENOENT'←[39m,
  code: ←[32m'ENOENT'←[39m,
  syscall: ←[32m'spawn cmd'←[39m,
  path: ←[32m'cmd'←[39m,
  spawnargs: [ ←[32m'/c'←[39m, ←[32m'start'←[39m, ←[32m'""'←[39m, ←[32m'/b'←[39m
, ←[32m'http://localhost:3000/'←[39m ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! rtapp@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the rtapp@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\abc\AppData\Roaming\npm-cache\_logs\2019-07-13T11_03_11_73
6Z-debug.log

This is the log file, Iam not able to figure out the error from this file.这是日志文件,我无法从该文件中找出错误。

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.9.0
3 info using node@v12.6.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle rtapp@0.1.0~prestart: rtapp@0.1.0
6 info lifecycle rtapp@0.1.0~start: rtapp@0.1.0
7 verbose lifecycle rtapp@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle rtapp@0.1.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\abc\rtapp\node_modules\.bin;C:\Users\abc\AppData\Roaming\npm;C:\Program Files\nodejs\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Java\jdk1.7.0_25\bin;C:\Program Files (x86)\Brackets\command;C:\Program Files\PuTTY\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;C:\Program Files\Java\jdk1.7.0_25\bin;C:\Users\abc\AppData\Roaming\npm;C:\Users\abc\AppData\Local\Programs\Microsoft VS Code\bin
9 verbose lifecycle rtapp@0.1.0~start: CWD: C:\Users\abc\rtapp
10 silly lifecycle rtapp@0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle rtapp@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle rtapp@0.1.0~start: Failed to exec start script
13 verbose stack Error: rtapp@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:203:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:203:13)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid rtapp@0.1.0
15 verbose cwd C:\Users\abc\rtapp
16 verbose Windows_NT 6.1.7601
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.6.0
19 verbose npm  v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error rtapp@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the rtapp@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

It is failing to execute the start scripts.无法执行启动脚本。

Since it's an issue in events.js my first suspicion is that the process is running twice somewhere so it can't use the specified port (3000).由于这是 events.js 中的一个问题,我的第一个怀疑是该进程在某处运行了两次,因此它无法使用指定的端口 (3000)。 Try closing all node instances and retrying.尝试关闭所有节点实例并重试。 Or change the port number if you have something else already running on port 3000.或者,如果您已经在端口 3000 上运行了其他东西,请更改端口号。

Or try:或尝试:

rmdir /s node_modules

npm cache clean --force

npm install

暂无
暂无

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

相关问题 npm 在创建反应应用程序后在 cmd 上启动总是给出错误 - npm start on cmd after creating react app always gives error 使用 cmd 在 React Js 应用程序中启动时出现 npm start 错误 - npm start error on Starting in React Js App using cmd 使用 React 应用程序启动 npm 时出错 - Getting error when npm start with React application 当我尝试使用npm start命令运行React App时出错 - Error when I try run a React App with npm start command 在创建反应项目时在“npx create-react-app my-app”之后运行命令“npm start”时出错 - getting error when run command 'npm start' after 'npx create-react-app my-app' in creating a react project 当我编写 npm start 并收到此错误时,我的反应应用程序没有启动,任何人都可以帮助我,我是新来的反应。 我正在使用 Acode(Editor) 和 termux - My react app does not start when I write npm start and get this error can anyone please help me I am new to react. I am using Acode(Editor) and termux 在npm上启动启动应用程序时出错 - Getting error on npm start create-react-app 创建反应应用程序时出现 npm 启动错误 - Getting npm start error while creating a react app 尝试在iPhone上构建React Native应用时出现&#39;npm start&#39;错误? - Getting 'npm start' error when trying to build React Native app on iphone? 运行 npm start 时,要启动反应项目,我会在终端上收到以下消息 - when running npm start, to start a react project I get the following messages on the terminal
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM