TypeError [ERR_INVALID_ARG_TYPE]:“路径"参数必须为字符串类型.启动React应用时收到的类型未定义引发 [英] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined raised when starting react app
问题描述
我正在React的一个项目上工作,遇到一个让我感到困扰的问题.
I'm working on a project in React and ran into a problem that has me stumped.
每当我运行 yarn start
时,都会出现此错误:
Whenever I run yarn start
I get this error:
TypeError [ERR_INVALID_ARG_TYPE]:"path"参数必须是类型细绳.收到的类型未定义
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
我不知道为什么会这样,如果有人经历过,我将不胜感激.
I have no idea why this is happening, if anyone has experienced this I would be grateful.
推荐答案
要解决此问题,只需升级反应脚本程序包(使用 npm info react-scripts版本检查最新版本代码>):
To fix this issue simply upgrade react-scripts package (check latest version with npm info react-scripts version
):
- 将您的 package.json
"react-scripts":"^ 3.xx"
替换为"react-scripts":"^ 3.4.1"
(或最新可用版本) - (某些情况可选)删除您的 node_modules 文件夹
- 运行
npm install
或yarn install
- Replace in your package.json
"react-scripts": "^3.x.x"
with"react-scripts": "^3.4.1"
(or the latest available version) - (optional for some) Delete your node_modules folder
- Run
npm install
oryarn install
有人报告说此问题是由于运行 npm审核修复程序
(请避免!)引起的.
Some people reported that this issue was caused by running npm audit fix
(avoid it!).
这篇关于TypeError [ERR_INVALID_ARG_TYPE]:“路径"参数必须为字符串类型.启动React应用时收到的类型未定义引发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!