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

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

问题描述

我正在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):

  1. 将您的 package.json "react-scripts":"^ 3.xx" 替换为"react-scripts":"^ 3.4.1"(或最新可用版本)
  2. (某些情况可选)删除您的 node_modules 文件夹
  3. 运行 npm install yarn 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审核修复程序(请避免!)引起的.

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

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

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