类型错误 [ERR_INVALID_ARG_TYPE]:“路径”参数必须是字符串类型。收到的类型未定义

2024-05-06

我正在尝试在本地计算机中运行反应应用程序,运行时出现此错误npm run start:

> node scripts/start.js

internal/validators.js:125
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:125:11)
    at Object.resolve (path.js:161:7)
    at resolveApp (D:\Projects\react-app\react-site-master\config\paths.js:10:41)
    at Object.<anonymous> (D:\Projects\react-app\react-site-master\config\paths.js:73:13)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! g[email protected] /cdn-cgi/l/email-protection start: `node scripts/start.js`
npm ERR! Exit status 1

我尝试执行以下操作,但结果是相同的:

  1. npm 缓存清理 --force
  2. 使用 package-lock.json 删除 node_modules
  3. npm 安装

提前致谢,


确保您有正确版本的反应脚本。尝试react-scripts 3.4.0。

如果您有以前版本的react-scripts,您可以按照有关如何从您的版本迁移到3.4.0的说明进行操作:https://github.com/facebook/create-react-app/releases https://github.com/facebook/create-react-app/releases

另一种选择是更新您的 package.json 文件以使用"react-scripts": "3.4.0"。确保在运行之前删除 node_modules 文件夹和 package-lock.jsonnpm install更新 package.json 后

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

类型错误 [ERR_INVALID_ARG_TYPE]:“路径”参数必须是字符串类型。收到的类型未定义 的相关文章

随机推荐