React 项目启动报错:The “path” argument must be of type string

    技术2022-07-20  100

    今天下载一个旧的React项目,yarn start 运行,报错:

    TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received type undefined

    在stackoverflow上找到了解决方法,只需要把package.json 中 react-scripts升级到”^3.4.0″ 即可。

    javascript – TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received type undefined raised when starting react app – Stack Overflow

    解决方法:

    安装 react-scripts 3.4.1( react-scripts – npm 目前版本为3.4.1)

    npm install —save react–scripts@3.4.1

    或者

    删除node_modules文件夹,删除package-lock.json执行npm install 或者 yarn install重新安装依赖包

    本质原因是什么,待进一步研究。。。

     

     

     

     

     

     

     

     

    Processed: 0.016, SQL: 9