美文网首页
Ant Design Mobile 报Cannot find m

Ant Design Mobile 报Cannot find m

作者: Kagashino | 来源:发表于2018-10-26 20:44 被阅读0次

    使用create-react-appa搭建Antd Modile脚手架之后,按照官网提示修改配置,运行命令如下:

    yarn add react-app-rewired --dev
    

    运行start命令时时抛出如下错误:

    react-app-rewired start
    
    module.js:550
        throw err;
        ^
    
    Error: Cannot find module 'react-scripts/package.json'
        at Function.Module._resolveFilename (module.js:548:15)
        at Function.resolve (internal/module.js:18:19)
        at Object.<anonymous> (D:\project\pb-antd\node_modules\react-app-rewired\scripts\utils\paths.js:25:11)
        at Module._compile (module.js:653:30)
        at Object.Module._extensions..js (module.js:664:10)
        at Module.load (module.js:566:32)
        at tryModuleLoad (module.js:506:12)
        at Function.Module._load (module.js:498:3)
        at Module.require (module.js:597:17)
        at require (internal/module.js:11:18)
    

    经过分析(过程略),替换为npm安装,出现以下提示:

    npm WARN react-app-rewired@1.6.2 requires a peer of react-scripts@^1.0.14 but none is installed. You must install peer dependencies yourself.

    npm提示,react-scripts peer依赖未安装,然而在npm3.0版之后,peer依赖已经不再写入package.json中了

    解决方法

    将 react-scripts添加到dev依赖中

      yarn add react-scripts --dev
    

    运行成功

    相关文章

      网友评论

          本文标题:Ant Design Mobile 报Cannot find m

          本文链接:https://www.haomeiwen.com/subject/gibltqtx.html