tiptap: Error: Looks like multiple versions of prosemirror-model were loaded
Describe the bug When using the editor (e.g. using ENTER key) it’s not working, and we got error in the console:
Can not convert <> to a Fragment (looks like multiple versions of prosemirror-model were loaded)
Due to prosemirror-model@1.8.2 and prosemirror-model@1.9.0 loaded simultaneously.
tiptap-extensions package requires strictly version 1.8.2 and other packages prosemirror-model@^1.0.0, prosemirror-model@^1.1.0, prosemirror-model@^1.8.1 which resolves to 1.9.0
Steps to Reproduce / Codesandbox Example Steps to reproduce the behaviour:
- install
"tiptap": "^1.27.1",
"tiptap-extensions": "^1.29.1"
with Yarn. This will install prosemirror-model@1.8.2 and prosemirror-model@1.9.1.
- When using the editor (e.g. using ENTER key) it’s not working, and we got error in the console
Expected behaviour
Editor should work, there should be only one prosemirror-model package installed.
Quick and dirty workaround for users (it’s not proper fix!) - use resolutions entry in package.json:
"resolutions": {
"prosemirror-model": "1.9.1"
}
Then remove node_modules, yarn.lock and install packages again.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 159
- Comments: 112 (15 by maintainers)
Commits related to this issue
- Workaround for tiptap/prosemirror dependency mess https://github.com/scrumpy/tiptap/issues/577 — committed to ditojs/dito by lehni 4 years ago
- fix: 🐛 lock `prosemirror-model` version (https://github.com/Leecason/element-tiptap/issues/129) ref https://github.com/scrumpy/tiptap/issues/577 close https://github.com/Leecason/element-tiptap/issu... — committed to Leecason/element-tiptap by Leecason 4 years ago
- Fix tiptap / prosemirror resolutions (again...) See: https://github.com/ueberdosis/tiptap/issues/577 https://github.com/ueberdosis/tiptap/issues/720 https://github.com/ueberdosis/tiptap/issues/760 — committed to ditojs/dito by lehni 4 years ago
- Fix tiptap / prosemirror resolutions See ueberdosis/tiptap#577 — committed to naept/tiptap-extension-collaboration by Julien1138 4 years ago
- Update package.json Update package.json to fix the prosemirror-model mismatch versions. See my comment here: https://github.com/ueberdosis/tiptap/issues/577#issuecomment-728143889 https://github.... — committed to Guillaume-N/tiptap by Guillaume-N 4 years ago
- fix: avoid crash for rich-markdown-editor This was fixed temporarily by adding a specific version of prosemirror-model that is used by rich-markdown-editor in "resolutions". See more: https://github... — committed to fnky/editorial by fnky 3 years ago
- Fix multiple versions of prosemirror-model were loaded (#728) Related to https://github.com/ueberdosis/tiptap/issues/577 — committed to yorkie-team/yorkie-js-sdk by hackerwins 5 months ago
- Fix enter not working on editor Apparently bun got stuck loading two versions of prosemirror-model, see: https://github.com/ueberdosis/tiptap/issues/577 Solved by deleting bun.lock and rerunning `bu... — committed to manifoldmarkets/manifund by akrolsmir 3 months ago
I was just writing up a issue for this error. prosemirror-state released 1.3.3 earlier today so a clean install with “tiptap”: “1.26.6” and “tiptap-extensions”: “1.28.6” would throw the above error.
Adding the following to my package.json file did fix the issues on a clean install:
But it may be worth adding the other prosemirror packages to avoid similar conflicts in the future as @paramono suggests.
Can this be addressed through tiptap to avoid these types of conflicts?
@philippkuehn Do we know when the fix will be released for this? It is breaking the current TipTap.
yarn upgrade --pattern "@tiptap|prosemirror"resolved the issue for me with only the related packages altered.this issue has returned in tiptap@1.30.0
With the latest version of tiptap (
1.30.0) and tiptap-extensions (1.33.2) the resolutions needs to be updated:Then it is a matter of cleaning and reinstalling
rm -Rf node_modules/ yarn.lockyarn cache cleanyarn install(Message for those of you who still have errors and the proposed workaround doesn’t help)
I tried the workaround with
resolutionsin package.json, but it didn’t help even after clean install.Then I thoroughly checked which packages are installed in yarn.lock, and found that not only different versions of
prosemirror-modelwere installed, but other prosemirror packages as well. So I simply pinpointed their versions inresolutionsto avoid duplication, and made a clean reinstall.This is what I had to enter in
resolutionsto make tiptap work:To summarize, this is what I did:
resolutionsto prevent multiple versions of the same package from installing (you can try myresolutionsabove)rm -rf node_modulesyarn cache cleanyarn install"resolutions": { "prosemirror-model": "1.8.2" }This solution worked for me using yarn. I just added it, deletes
node_modules/and did a yarn installHello everyone,
I was wondering if a solution to this issue has been found? I have try the solutions proposed above but no one work.
I work with tiptap@1.30 and tiptap-extensions@1.33.2. I have the problem only with the enter key it seems.
Thanks for help
This will keep breaking with each prosemirror-model and prosemirror-state release (possibly other prosemirror libraries as well) until a fix is implemented.
I’ve corrected this on my end by enforcing a specific version of tiptap and using yarn resolutions to specify versions of prosemirror. This protects from tiptap or prosemirror getting updated unexpectedly, but it then requires watching both libraries for releases.
“tiptap”: “1.27.1”, “tiptap-extensions”: “1.29.1”,
“resolutions”: { “prosemirror-model”: “1.9.1”, “prosemirror-state”: “1.3.3”, },
It would be great to have a better solution though I am not familiar enough with dependency management and the cross-dependencies of tiptap libraries with prosemirror to suggest a permanent solution.
@FreekVR from what I know npm-shrinkwrap is really for old versions of npm, now with
package-lock.jsonwe don’t need it anymore.Is the current issue really an npm problem? I thought the
tiptap-extensionsstrictly requiringprosemirror-model@1.8.2was the simple problem. I’d love to hear from @philippkuehn here.I’d love to have a solution while sticking with npm instead of moving to yarn… anybody got something useful to suggest for this?
Same problem when using esm.sh CDN like https://tiptap.dev/docs/editor/installation/cdn.
But here’s very hacky tricky way for those of you who need to use it in a hurry. 😭 Map all multiple versions of prosemirror-model to one version using importmap.
Thanks everyone reporting this really annoying issue here!
Good news: I think it’s gone with the freshly released version of tiptap. 🎉
And sorry for the long wait! 🙌 We struggled to fund the support and maintenance of tiptap. We recently reached the $1,000/month milestone with sponsors, which allows us to put time into the maintenance of tiptap on a regular basis. Oh, and if you want to sponsors us too: All sponsors get instant access to the upcoming version 2 of tiptap. 👀
Don’t hesitate to comment if you encounter this issue again, happy to look at it then.
@karol-f, it is working now with fresh yarn install
Wouldn’t it help to mark the
prosemirror-*dependencies in the plugins as peer dependencies?@alexandremasy
Just using this works fine.
Will this be fixed? Or the whole project abandoned?
@samiell Did You install packages again after adding
resolutionsto package.json?Mentioned quick fix is working, I wonder why it’s not for You.
Thank you so much
I think it is only fixed until new version of
prosemirror-modelcomes out. I suggest using exact versions ofprosemirrorrelated packages in all tiptap packages, so npm and yarn have no chance at installing two different versions. Onlypackages/tiptap/package.jsonhas exact version specified right now.Agreed! And since lerna is already being used to publish both packages, why not use its fixed/locked mode for the hanlding of versioning (the default)?
One solution would be to use
peerDependenciesforprosemirror-viewpackage. It will always be deduplicated but consumers of tiptap will need to installprosemirror-viewmanually.Having
"prosemirror-view": "^1.15.7"intiptap-extensionsand"prosemirror-view": "1.15.7"intiptapdoes not help too.tiptap-extensionsshould probably have exact version ofprosemirrorpackages liketiptappackage itself.Can anyone release an update with locking the version?
Also encountered the problem meanwhile solved with resolutions but need a proper fix.
I also encountered this problem.
Having the same error. Using
tiptap@1.27.1andtiptap-extensions@1.29.1.It’s working with
yarn- make sure You use it and notnpm@stigvanbrabant maybe https://www.npmjs.com/package/npm-force-resolutions
I am experiencing this issue too.
In the meantime, the workaround suggested by @karol-f is resolving the issue .
If you’re using
yarnjust add the missingprosemirror-*packages:yarn add prosemirror-commands prosemirror-schema-list ...etc.when i use
"type": "commonjs"in package.json, it works. And with"type": "module", it not work.I am also receiving this issue.
This issue is happening even in latest version. Is there any long-term solution to this other than the
resolutionsin the package.json workaround ?Searching for
"prosemirror-model":in@tiptapdir gives these results:Thanks @arokanto, this solved the issue for me 🤗
I don’t think it’s fixed in CDN. Isn’t it? Does anyone know how to fix it in using CDN version? Thanks. Whenever I put enter inside the editor it spit out the stated error.
This seems like a straightforward solution. Why not add
tiptap-extensionsas a dependency oftiptaptoo, wouldn’t this avoid all the issues with version incompatibility?@hanspagel Thanks a lot! Removing
node_modulesand upgrading the new version 1.31.0 solved the issue!This workaround worked best for me. Thanks!
installing prosemirror-model at exactly the
1.11.2version at the root of my project seems to have fixed it for me for nowI also have this issue when upgrading to tiptap@1.30.0 and tiptap-extensions@1.32.4 had to rollback to version tiptap@1.29.6
I’ve updated all dependencies https://github.com/scrumpy/tiptap/commit/34d007aca7ff5d0183e5dd541aa0814fe6d10fbc right now but this is not the main issue. If anyone has an idea how to solve this at the core level: please tell me!
hmm… seems to me you should make it a peerDependency
Dear @philippkuehn or @karol-f could I kindly beg for a status update on this issue? Will it be fixed, or is the idea to simply not fix it in tiptap1 (expecting users to do resolutions hack, which isn’t great) but to do that in the upcoming tiptap2?
@karol-f
In my case it wasn’t enough, because I would still get duplicates of prosemirror packages, which would cause:
RangeError: Adding different instances of a keyed plugin (plugin$)Removing node_modules and cleaning yarn cache are probably optional, but including other prosemirror packages in
resolutionswas the only way I could make tiptap work for me.This is not a solution, as explicitly mentioned above in the very definition of this Issue, it’s just a dirty workaround.
have the same but finally it worked after adding the “resolutions” to the packages.json.
after a
yarn installit worked as it should be. Thank you very much.Of course I do use yarn. I tried to remove lock, add mentioned resolution, use specific versions, clear cache, remove node_modules … yet only downgrade to 1.25 fixed the issue.
Is there a workaround known when you’re using npm instead of yarn?