TypeError [ERR_INVALID_ARG_TYPE]: “路径"参数必须是字符串类型.启动反应应用程序时引发的接收类型未定义 [英] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined raised when starting react app

查看:42
本文介绍了TypeError [ERR_INVALID_ARG_TYPE]: “路径"参数必须是字符串类型.启动反应应用程序时引发的接收类型未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用 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.

推荐答案

要解决此问题,只需升级 react-scripts 包(使用 npm info react-scripts 版本检查最新版本代码>):

To fix this issue simply upgrade react-scripts package (check latest version with npm info react-scripts version):

  1. package.json "react-scripts": "^3.xx" 替换为 "react-scripts": "^3.4.1"(或最新的可用版本)
  2. (某些可选)删除您的 node_modules 文件夹
  3. 运行 npm installyarn install
  1. Replace in your package.json "react-scripts": "^3.x.x" with "react-scripts": "^3.4.1" (or the latest available version)
  2. (optional for some) Delete your node_modules folder
  3. Run npm install or yarn install

有些人报告说这个问题是由运行 npm audit fix 引起的(避免它!).

Some people reported that this issue was caused by running npm audit fix (avoid it!).

这篇关于TypeError [ERR_INVALID_ARG_TYPE]: “路径"参数必须是字符串类型.启动反应应用程序时引发的接收类型未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆