node.js - "path"参数必须是字符串类型。收到未定义。不知道为什么?

标签 node.js reactjs

我正在尝试运行我的 react 项目,但我不断收到此错误。
我已经重新安装了node和npm,但这个问题仍然存在。
想知道下一步该怎么做!

附上,是 package.json,希望它会有所启发。

我从我的 github 存储库中复制了那里的项目,但我仍然收到此错误。

{
  "name": "our-family-client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@blueprintjs/core": "^3.22.3",
    "bootstrap": "^4.3.1",
    "react": "^16.11.0",
    "react-autosuggest": "^9.4.3",
    "react-bootstrap": "^1.0.0-beta.14",
    "react-dom": "^16.11.0",
    "react-grid-gallery": "^0.5.5",
    "react-redux": "^7.1.1",
    "react-router-dom": "^5.1.2",
    "react-scripts": "^3.4.1",
    "reactstrap": "^8.1.1",
    "redux": "^4.0.4",
    "redux-devtools-extension": "^2.13.8",
    "redux-thunk": "^2.3.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "mocha",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^1.13.0",
    "@typescript-eslint/parser": "^1.13.0",
    "chai": "^4.2.0",
    "mocha": "^7.0.0",
    "noop-service-worker-middleware": "^3.0.0"
  }
}


TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at validateString (internal/validators.js:117:11)
    at Object.join (path.js:1039:7)
    at noopServiceWorkerMiddleware (/Users/saraginsburg/FlatIron/our-family/our-family-frontend/node_modules/react-dev-utils/noopServiceWorkerMiddleware.js:14:26)
    at Layer.handle [as handle_request] (/Users/saraginsburg/FlatIron/our-family/our-family-frontend/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/saraginsburg/FlatIron/our-family/our-family-frontend/node_modules/express/lib/router/index.js:317:13)
    at /Users/saraginsburg/FlatIron/our-family/our-family-frontend/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/Users/saraginsburg/FlatIron/our-family/our-family-frontend/node_modules/express/lib/router/index.js:335:12)
    at next (/Users/saraginsburg/FlatIron/our-family/our-family-frontend/node_modules/express/lib/router/index.js:275:10)
    at launchEditorMiddleware (/Users/saraginsburg/FlatIron/our-family/our-family-frontend/node_modules/react-dev-utils/errorOverlayMiddleware.js:20:7)
    at Layer.handle [as handle_request] (/Users/saraginsburg/FlatIron/our-family/our-family-frontend/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/saraginsburg/FlatIron/our-family/our-family-frontend/node_modules/express/lib/router/index.js:317:13)
    at /Users/saraginsburg/FlatIron/our-family/our-family-frontend/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/Users/saraginsburg/FlatIron/our-family/our-family-frontend/node_modules/express/lib/router/index.js:335:12)
    at next (/Users/saraginsburg/FlatIron/our-family/our-family-frontend/node_modules/express/lib/router/index.js:275:10)
    at handleWebpackInternalMiddleware (/Users/saraginsburg/FlatIron/our-family/our-family-frontend/node_modules/react-dev-utils/evalSourceMapMiddleware.js:42:7)
    at Layer.handle [as handle_request] (/Users/saraginsburg/FlatIron/our-family/our-family-frontend/node_modules/express/lib/router/layer.js:95:5)

最佳答案

我在运行 Node 10.0 时从 eslint 收到了这个确切的错误

在调查调用堆栈后,我发现一个依赖项正在使用 nodejs 路径模块 parameter这仅在 nodejs 10.10 中引入。
我打算打开一个问题,但我检查了 eslint 文档,果然 Node.js (^10.12.0, or >=12.0.0)被指定。

我建议你检查你的 Node.js 版本并至少升级到 10.10

关于node.js - "path"参数必须是字符串类型。收到未定义。不知道为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61354145/

相关文章:

node.js - 如何在 firebase 控制台上部署 ionic 4 应用程序?

reactjs - React Hook useEffect 缺少依赖项 : 'list'

javascript - 在 React 中,数字输入是字符串而不是整数

javascript - Redux - 相同的 reducer 、容器和组件产生不同的结果

javascript - 什么是 "app.router"express.js

javascript - 我想知道如何在服务器上的 HTML 文档中执行 JS

node.js - 为 TCP 套接字客户端连接指定本地端口

javascript - 需要 rnpm 链接的 React Native 组件依赖

css - 如何在 create-react-app 中自定义 blueprintjs 外观

javascript - 如何输入其 props 被部分应用的 React 组件?