outline / rich-markdown-editor

The open source React and Prosemirror based markdown editor that powers Outline. Want to try it out? Create an account:
https://www.getoutline.com
BSD 3-Clause "New" or "Revised" License
2.87k stars 589 forks source link

RangeError: Duplicate use of selection JSON ID cell #412

Closed growandwin closed 3 years ago

growandwin commented 3 years ago

After installing via npm install rich-markdown-editor

whole my next.js breaks without even making any changes to code. After I try to run npm run dev my app crashes with the following error

RangeError: Duplicate use of selection JSON ID cell
    at Function.jsonID (\node_modules\prosemirror-state\dist\index.js:192:34)
    at Object.<anonymous> (\node_modules\rich-markdown-editor\node_modules\prosemirror-tables\dist\index.js:712:28)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (\node_modules\rich-markdown-editor\dist\menus\formatting.js:7:30)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (\node_modules\rich-markdown-editor\dist\components\SelectionToolbar.js:43:38)

There is propably some dependency conflict with tina.io that I use (and wanted to replace for something simplier). Here are my deps from my package.json

 "dependencies": {
    "@agentofuser/remark-oembed": "^1.0.4",
    "@babel/runtime": "^7.13.10",
    "@hapi/iron": "6.0.0",
    "@sentry/browser": "^6.2.0",
    "@sentry/integrations": "^6.2.2",
    "@sentry/node": "^6.2.0",
    "@sentry/webpack-plugin": "^1.14.1",
    "@types/jsonwebtoken": "^8.5.0",
    "@zeit/next-source-maps": "0.0.3",
    "autoprefixer": "^10.2.4",
    "bcrypt": "^5.0.0",
    "child_process": "^1.0.2",
    "cloudinary": "^1.25.0",
    "cloudinary-core": "^2.11.3",
    "cookie": "0.4.0",
    "cross-env": "^7.0.2",
    "date-fns": "^2.16.1",
    "formik": "^2.2.6",
    "jsdom": "^16.5.0",
    "jsonwebtoken": "^8.5.1",
    "logrocket": "^1.0.14",
    "lru-cache": "^6.0.0",
    "mongodb": "^3.5.9",
    "multer": "^1.4.2",
    "next": "^10.0.9",
    "next-compose-plugins": "^2.2.1",
    "next-iron-session": "^4.1.12",
    "nodemailer": "^6.5.0",
    "pino": "^6.11.1",
    "pino-caller": "^3.0.2",
    "pino-logflare": "^0.3.7",
    "postcss": "^8.2.6",
    "postcss-flexbugs-fixes": "^5.0.2",
    "postcss-preset-env": "^6.7.0",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-google-recaptcha": "^2.1.0",
    "react-markdown": "^5.0.3",
    "react-tinacms-editor": "^0.37.0",
    "react-tinacms-inline": "^0.37.0",
    "remark-gfm": "^1.0.0",
    "remarkable": "^2.0.1",
    "rich-markdown-editor": "^11.6.0",
    "sanitize-html": "^2.3.2",
    "styled-components": "^5.2.1",
    "styled-jsx": "^3.4.2",
    "swr": "^0.4.1",
    "tinacms": "^0.37.0",
    "uuidv4": "6.2.5",
    "xss": "^1.0.8",
    "yup": "^0.32.9"
  },
  "devDependencies": {
    "@testing-library/dom": "^7.30.0",
    "@testing-library/react": "^11.2.5",
    "@types/next-auth": "3.1.14",
    "@types/node": "^14.14.6",
    "@types/react": "16.9.56",
    "@typescript-eslint/eslint-plugin": "^4.14.1",
    "@typescript-eslint/parser": "^4.14.1",
    "babel-jest": "^26.6.3",
    "cypress": "^6.6.0",
    "eslint": "^7.18.0",
    "eslint-config-prettier": "^7.2.0",
    "eslint-plugin-cypress": "^2.11.2",
    "eslint-plugin-jsx-a11y": "^6.4.1",
    "eslint-plugin-prettier": "^3.3.1",
    "eslint-plugin-react": "^7.22.0",
    "eslint-plugin-react-hooks": "^4.2.0",
    "gray-matter": "^4.0.2",
    "prettier": "^2.2.1",
    "remark": "^13.0.0",
    "remark-html": "^13.0.1",
    "remark-parse": "^9.0.0",
    "remark-react": "^8.0.0",
    "ts-node": "^9.1.1",
    "typescript": "^4.0.5",
    "typescript-eslint": "0.0.1-alpha.0"
  }

Any ideas how to fix that? What is annoying - removing the package doesn't solve the problem. Deleting node_modules doesn't solve the problem... You need to npm prune, reinstall next and babel runtime to fix this problem.

tommoor commented 3 years ago

It looks like it's caused by having two versions of prosemirror-tables in your app, could try overriding to pin to a single version? I don't think rich-markdown-editor is super fussy about that dependency right now

tommoor commented 3 years ago

I'm going to close as this is an issue with your unique package situation, not this repo but feel free to leave additional comments