zoukankan      html  css  js  c++  java
  • react 使用react-app-rewired后启动不了

    使用了

      "scripts": {
        "start": "react-app-rewired start",
        "build": "react-app-rewired build",
        "test": "react-app-rewired  test",
        "eject": "react-app-rewired eject"
      },
    

    后报错信息如下:

    internal/modules/cjs/loader.js:638
        throw err;
        ^
    
    Error: Cannot find module 'react-scripts/package.json'
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
        at Function.resolve (internal/modules/cjs/helpers.js:33:19)
        at Object.<anonymous> (C:...
    ode_modules
    eact-app-rewiredscriptsutilspaths.js:27:11)
        at Module._compile (internal/modules/cjs/loader.js:776:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
        at Module.load (internal/modules/cjs/loader.js:653:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
        at Function.Module._load (internal/modules/cjs/loader.js:585:3)
        at Module.require (internal/modules/cjs/loader.js:690:17)
        at require (internal/modules/cjs/helpers.js:25:18)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! react-blog@0.1.0 start: `react-app-rewired start`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the react-blog@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:...AppDataRoaming
    pm-cache\_logs2019-11-02T08_08_28_567Z-debug.log
    

    报错第一行就能看到如何解决:

    npm install react-scripts
    

    然后重新启动

    npm start
    

    即可

  • 相关阅读:
    单div绘制多元素图
    js笔试题系列之二——数组与对象
    JS设计模式——策略模式
    js笔试题系列之三——函数
    zepto.js中的Touch事件
    java定时任务之Scheduled注解
    汤姆大叔送书,咱也科学抢书
    Asp.net Mvc自定义客户端验证(CheckBox列表的验证)
    摆脱烂项目
    我的ORM发展史
  • 原文地址:https://www.cnblogs.com/daixixi/p/11782831.html
Copyright © 2011-2022 走看看