今天下载一个旧的 React 项目, yarn start 运行, 报错:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
在 Stack Overflow 上找到了解决方法, 只需要把 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 https://www.npmjs.com/package/react-scripts 目前版本为 3.4.1)
NPM install -save react-scripts@3.4.1
或者
删除 node_modules 文件夹, 删除 package-lock.JSON
执行 NPM install 或者 yarn install 重新安装依赖包
本质原因是什么, 待进一步研究...
来源: http://www.mzh.ren/react-scripts-path-argument-error.html