最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

reactjs - Object prototype may only be an Object or null: undefined when import the package `texhub-broadcast` - Stack Overflow

programmeradmin2浏览0评论

when I import the project "texhub-broadcast": "1.0.5" in the browser project, shows error:

react.development.js:1407 Uncaught TypeError: Object prototype may only be an Object or null: undefined
    at Function.create (<anonymous>)
    at Object.inherits (inherits_browser.js:6:31)
    at node_modules/.pnpm/[email protected]/node_modules/send/index.js (index.js:173:6)
    at __require2 (chunk-PLDDJCW6.js?v=66c55fcc:17:50)
    at node_modules/.pnpm/[email protected]/node_modules/express/lib/utils.js (utils.js:20:12)
    at __require2 (chunk-PLDDJCW6.js?v=66c55fcc:17:50)
    at node_modules/.pnpm/[email protected]/node_modules/express/lib/application.js (application.js:24:19)
    at __require2 (chunk-PLDDJCW6.js?v=66c55fcc:17:50)
    at node_modules/.pnpm/[email protected]/node_modules/express/lib/express.js (express.js:18:13)
    at __require2 (chunk-PLDDJCW6.js?v=66c55fcc:17:50)

the express works with the texhub-broadcast on the server side, seems the browser project load and run the texhub-broadcast facing issue. But I only load the SocketIOProvider class from the project texhub-broadcast, why the current project run the express? what should I do to fixed this issue? can I use the texhub-broadcast package in the browser type project? This is the current project package.json:

{
  "name": "texhub-web",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@ant-design/icons": "^5.5.2",
    "@babel/plugin-transform-class-properties": "^7.25.9",
    "@codemirror/autocomplete": "github:overleaf/codemirror-autocomplete#v6.12.0-overleaf-2",
    "@codemirror/lang-javascript": "^6.2.2",
    "@codemirror/language": "^6.10.7",
    "@codemirror/legacy-modes": "^6.4.2",
    "@codemirror/search": "^6.5.8",
    "@codemirror/state": "^6.5.0",
    "@codemirror/view": "^6.36.1",
    "@fingerprintjs/fingerprintjs": "^4.5.1",
    "@fortawesome/fontawesome-svg-core": "^6.7.2",
    "@fortawesome/free-brands-svg-icons": "^6.7.2",
    "@fortawesome/free-regular-svg-icons": "^6.7.2",
    "@fortawesome/free-solid-svg-icons": "^6.7.2",
    "@fortawesome/react-fontawesome": "^0.2.2",
    "@lezer/common": "^1.2.3",
    "@lezer/generator": "^1.7.2",
    "@lezer/highlight": "^1.2.1",
    "@lezer/lr": "^1.4.2",
    "@overleaf/o-error": "^3.4.0",
    "@reduxjs/toolkit": "^2.5.0",
    "@testing-library/jest-dom": "^5.17.0",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "@types/jexcel": "^3.9.8",
    "@types/node": "^22.10.2",
    "@types/react": "^18.3.18",
    "@types/react-dom": "^18.3.5",
    "@types/react-redux": "^7.1.34",
    "@types/uuid": "^9.0.8",
    "@vitejs/plugin-react": "^4.3.4",
    "@wojtekmaj/async-array-utils": "^1.8.1",
    "antd": "^5.22.5",
    "axios": "^1.7.9",
    "bootstrap": "5.3.3",
    "bootstrap-table": "^1.24.0",
    "bowser": "^2.11.0",
    "chai": "^5.1.2",
    "clipboard-polyfill": "^4.1.1",
    "cm6-theme-basic-light": "^0.2.0",
    "cm6-theme-solarized-dark": "^0.2.0",
    "cm6-theme-solarized-light": "^0.2.0",
    "codemirror": "^6.0.1",
    "dayjs": "^1.11.13",
    "i18next": "^23.16.8",
    "jspreadsheet-ce": "^4.15.0",
    "lib0": "^0.2.99",
    "lodash": "^4.17.21",
    "pdfjs-dist": "^4.9.155",
    "query-string": "^8.2.0",
    "rc-table": "7.40.0",
    "rd-component": "^0.1.169",
    "rdjs-wheel": "0.0.31",
    "rdy-websocket": "1.5.0",
    "react": "^18.3.1",
    "react-arborist": "^3.4.0",
    "react-copy-to-clipboard": "^5.1.0",
    "react-dom": "^18.3.1",
    "react-error-boundary": "^4.1.2",
    "react-i18next": "^13.5.0",
    "react-pdf": "^9.2.1",
    "react-redux": "^8.1.3",
    "react-router-dom": "^7.1.0",
    "react-scripts": "5.0.1",
    "react-syntax-highlighter": "^15.6.1",
    "react-toastify": "^9.1.3",
    "react-turnstile": "^1.1.4",
    "react-virtualized-auto-sizer": "^1.0.25",
    "react-window": "^1.8.11",
    "react-window-infinite-loader": "^1.0.9",
    "redux": "^4.2.1",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.4.2",
    "rollup-plugin-visualizer": "^5.12.0",
    "sass": "^1.83.0",
    "socket.io-client": "^4.8.1",
    "ts-node": "^10.9.2",
    "uuid": "^9.0.1",
    "vite": "^5.4.11",
    "vite-plugin-svgr": "^4.3.0",
    "vite-plugin-top-level-await": "^1.4.4",
    "vite-plugin-wasm": "^3.4.1",
    "web-vitals": "^2.1.4",
    "y-codemirror.next": "^0.3.5",
    "yjs": "^13.6.21",
    "texhub-broadcast": "1.0.5"
  },
  "scripts": {
    "start": "react-scripts start",
    "test": "jest",
    "eject": "react-scripts eject",
    "build": "tsc && vite build",
    "dev": "vite --host=0.0.0.0 --port=3003"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ],
    "plugins": [
      "react-hooks"
    ],
    "rules": {
      "react-hooks/rules-of-hooks": "error",
      "react-hooks/exhaustive-deps": "warn"
    }
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@types/bootstrap": "^5.2.10",
    "@types/jest": "^27.5.2",
    "@types/lodash": "^4.17.13",
    "@types/react-copy-to-clipboard": "^5.0.7",
    "@types/react-syntax-highlighter": "^15.5.13",
    "@types/react-window": "^1.8.8",
    "@types/redux-logger": "^3.0.13",
    "eslint-plugin-react-hooks": "^4.6.2",
    "jest": "^29.7.0",
    "ts-jest": "^29.2.5",
    "typescript": "^4.9.5"
  },
  "pnpm": {
    "overrides": {
      "pdfjs-dist": "^4.9.155"
    }
  },
  "overrides": {
    "react-pdf": {
      "pdfjs-dist": "4.9.155"
    }
  }
}

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论