React报错:TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type...

2,548 阅读1分钟

React 在启动项目时报错

npm start

报错内容:

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

// 大概意思:TypeError [ERR_INVALID_ARG_TYPE]:“路径”参数必须为字符串类型。 接收类型未定义

原因

npmjs中的 react-scripts升级了,现在升级到了3.4.1

npm地址:[www.npmjs.com/package/rea…]

解决方法:

  • 在package.json中的dependencies配置项下,把"react-scripts": "^3.x.x" 改为"react-scripts": "^3.4.1"
  • 然后执行npm install 或者 yarn install重新安装依赖就OK了!