Skip to content

Object prototype may only be an Object or null: undefined #109

@ningji

Description

@ningji

When migrating my app from react 17 to 18, got this in chrome when starting my app.

Uncaught runtime errors:
×
ERROR
Object prototype may only be an Object or null: undefined
TypeError: Object prototype may only be an Object or null: undefined
at Function.create ()
at Object.inherits (http://localhost:3010/static/js/bundle.js:62529:31)
at ./node_modules/jws/lib/data-stream.js (http://localhost:3010/static/js/bundle.js:66271:6)
at options.factory (http://localhost:3010/static/js/bundle.js:230212:31)
at webpack_require (http://localhost:3010/static/js/bundle.js:229657:33)
at fn (http://localhost:3010/static/js/bundle.js:229869:21)
at ./node_modules/jws/lib/sign-stream.js (http://localhost:3010/static/js/bundle.js:66295:18)
at options.factory (http://localhost:3010/static/js/bundle.js:230212:31)
at webpack_require (http://localhost:3010/static/js/bundle.js:229657:33)
at fn (http://localhost:3010/static/js/bundle.js:229869:21)

There're plenty of changes i made to migrate to react 18, so not very sure which one caused the issue. I'll update more info if i find out more, but this is the most of the package.json (except our internal libs). Any help appreciated.

  "scripts": {
    "start": "chmod +x ./env.sh && ./env.sh && mv env-config.js ./public/ && PORT=3010 react-app-rewired start",
    "build": "react-app-rewired build",
    "test": "CI=true react-app-rewired test --reporters=default --reporters=jest-junit --testResultsProcessor=jest-sonar-reporter",
    "test:watch": "react-app-rewired test",
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "lint-staged": {
    "*.{html,js,json,jsx,md,sass,scss,yaml,yml}": [
      "npx prettier --write ."
    ],
    "*.{js,jsx}": [
      "npx eslint --fix ."
    ]
  },
  "dependencies": {
    "framer-motion": "10.16.2",
    "jsonwebtoken": "9.0.2",
    "moment": "^2.29.4",
    "moment-timezone": "^0.5.43",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-router-dom": "6.15.0",
    "react-scripts": "5.0.1",
    "react-toastify": "8.2.0",
    "sass": "1.66.1",
    "web-vitals": "3.4.0"
  },
  "devDependencies": {
    "@testing-library/jest-dom": "6.1.2",
    "@testing-library/react": "14.0.0",
    "@testing-library/user-event": "14.4.3",
    "buffer": "^6.0.3",
    "husky": "8.0.3",
    "jest-junit": "16.0.0",
    "jest-sonar-reporter": "2.0.0",
    "lint-staged": "14.0.1",
    "prettier": "3.0.3",
    "process": "^0.11.10",
    "react-app-rewired": "^2.2.1",
    "util": "^0.12.5"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions