“npm start"错误对于新创建的项目 [英] Error in "npm start" for newly created project

查看:106
本文介绍了“npm start"错误对于新创建的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚创建了一个 react js 项目.然后我运行npm start"来运行项目.这个错误来了,我现在被困在这里 1 天了.我已经有其他的 reactJS 项目了.此错误适用于所有其他项目.这就是为什么我在新项目中尝试了它.所以我通过创建新项目来确认.错误不在我的项目中.

I just created a react js project. Then I run "npm start" for run the project. this error come and I am stuck here for 1 day now. I have already have other reactJS projects. This error came for all other projects. That's why I tried it with new project. So I confirmed by creating new project. Error is not in my project.

我已经试过了.

  • 删除 node_module 文件夹,然后 npm install
  • 清除节点缓存.
  • 重新安装 node.js
  • 创建新项目.
  • 减少'react-script'的版本
  • 卸载node.js,删除c盘所有名称为node"的文件
  • 安装旧版本的 node.js

错误是,

C:\Suranga\ReactJS\JMSL\my_app>npm start

> my_app@0.1.0 start C:\Suranga\ReactJS\JMSL\my_app
> react-scripts start
> Starting the development server...
events.js:174
      throw er; // Unhandled 'error' event
      ^
Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my_app@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my_app@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-09-10T15_10_01_727Z-debug.log
C:\Suranga\ReactJS\JMSL\my_app>

推荐答案

为了存档目的,这里是 OP 报告的解决方案.

For archive purposes, here is the solution reported by OP.

降级到 react-scripts 2.1.8.

create-react-app my-app
cd my-app
npm install react-scripts@2.1.8
npm start

这篇关于“npm start"错误对于新创建的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆