解决React错误:TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined

运行React应用:

yarn start

报错:

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

在stackoverflow上找到了解决方法,只需要把react-scripts升级到"^3.4.0"即可。

解决步骤:

  1. 在package.json中,把"react-scripts": "^3.x.x" 替换为"react-scripts": "^3.4.0"
  2. 删除node_modules文件夹
  3. 执行npm install 或者 yarn install重新安装依赖包

版权声明:著作权归作者所有。

相关推荐