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

时间:2022-06-28 17:51:20

运行React应用:

yarn start

报错:

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

在*上找到了解决方法,只需要把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重新安装依赖包