-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Looks like multiple versions of prosemirror-model were loaded #577
Comments
I am experiencing this issue too. In the meantime, the workaround suggested by @karol-f is resolving the issue . |
I am experiencing the same issue. The suggested fix is not working either. |
@samiell Did You install packages again after adding Mentioned quick fix is working, I wonder why it's not for You. |
I think this is the same issue. I get this in the console |
This looks like a smoking gun ... Here's a fresh issue from prosemirror-utils: Update prosemirror-tables to 1.0.0 #85. Perhaps asking this person politely to update the dependencies will solve the issue. I did. |
Is there a workaround known when you're using npm instead of yarn? |
@karol-f yeah i tried that one but it doesn't seem to resolve the issue |
Also experiencing this issue (I'm using npm). |
Isn't the clean solution simply for the maintainer @philippkuehn to bump up the dependency of tiptap from [email protected] to the latest [email protected] ? I would prefer not relying on dirty workarounds. |
@jscaux it might not be so simple. I've checked some time ago and there were compatibility issues with package newer than |
I guess this error is being thrown by Fragment.from in prosemirror-model/src/fragment.js. The problem seems to be (from the console log |
The mentioned solution didn't help me. Nor even with the clean install :/
|
It's working with |
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. |
@danielchodusov Take a look at your |
have same problem |
same here |
This solution worked for me using yarn. I just added it, deletes |
Just what I was looking for, hopefully, this will be resolved without this workaround at somepoint |
I'd love to have a solution while sticking with npm instead of moving to yarn... anybody got something useful to suggest for this? |
@jscaux Just modify the line in dependencies to |
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. 😭 <head>
<script type="importmap">
{
"imports": {
"https://esm.sh/v135/[email protected]/es2022/prosemirror-model.mjs": "https://esm.sh/v135/[email protected]/es2022/prosemirror-model.mjs"
}
}
</script>
</head>
<body>
<script type="module">
import { Editor } from 'https://esm.sh/@tiptap/core';
// ...
</script>
</body> |
Apparently bun got stuck loading two versions of prosemirror-model, see: ueberdosis/tiptap#577 Solved by deleting bun.lock and rerunning `bun install`
Using esm.sh CDN with alpine.js I also encountered this issue. The workaround from @nemorize helps, for me it is: <script type="importmap">
{
"imports": {
"https://esm.sh/v135/[email protected]/es2022/prosemirror-model.mjs": "https://esm.sh/v135/[email protected]/es2022/prosemirror-model.mjs"
}
}
</script> My code in my django template looks like this: {% extends "_dashboard_base.html" %}
{% block dashboard_content %}
<div class="w-full">
<div class="block w-full rounded-md px-5 py-3 text-typography-default ring-1 ring-primary-black focus:ring-1 placeholder:text-typography-light sm:text-sm sm:leading-6">
<div x-data="editor('<p>Hello world! :-)</p>')">
<template x-if="isLoaded()">
<div class="border-b-solid border-b border-b-gray-200 pb-3">
<div class="flex items-center gap-3 py-1.5">
<button @click="toggleBold()"
:class="{ 'is-active' : isActive('bold', updatedAt) }"
class="rounded-lg font-semibold is-active bg-typography-light hover:bg-typography-medium text-white py-1 px-2">
Bold
</button>
<button @click="toggleItalic()"
:class="{ 'is-active' : isActive('italic', updatedAt) }"
class="rounded-lg font-semibold is-active bg-typography-light hover:bg-typography-medium text-white py-1 px-2">
Italic
</button>
</div>
</div>
</template>
<div x-ref="element"></div>
</div>
</div>
</div>
<script type="module">
import {Editor} from 'https://esm.sh/@tiptap/core'
import StarterKit from 'https://esm.sh/@tiptap/starter-kit'
document.addEventListener('alpine:init', () => {
Alpine.data('editor', (content) => {
let editor;
return {
updatedAt: Date.now(), // force Alpine to rerender on selection change
init() {
const _this = this
editor = new Editor({
element: this.$refs.element,
extensions: [
StarterKit
],
content: content,
onCreate({ editor }) {
_this.updatedAt = Date.now()
},
onUpdate({ editor }) {
_this.updatedAt = Date.now()
},
onSelectionUpdate({ editor }) {
_this.updatedAt = Date.now()
}
})
},
isLoaded() {
return editor
},
isActive(type, opts = {}) {
return editor.isActive(type, opts)
},
toggleBold() {
editor.chain().toggleBold().focus().run()
},
toggleItalic() {
editor.chain().toggleItalic().focus().run()
},
}
})
})
</script>
{% endblock dashboard_content %} |
Just ran into this issue today out of nowhere. It's been months since anyone posted here, but for anyone who ends up here with the same issue, and you have a similar setup to me, here's how I solved it in my webpack configuration. I have multiple common JS packages shared across a website, a browser extension, and a bunch of back-end cloud functions. My most-common JS package is one that is shared across ALL of the pieces of our system. To resolve this bug, I got into the webpack configuration of my shared package, and I added this bit: externals: {
'prosemirror-model': {
commonjs: 'prosemirror-model',
commonjs2: 'prosemirror-model',
amd: 'prosemirror-model',
root: 'prosemirrorModel',
}
} And then I got into the webpack configuration for each of my outer packages that are dependent on this common package, the ones that import this common package, and I added some code like this to their webpack configuration: // Etc.
resolve: {
alias: {
"prosemirror-model": path.resolve(
__dirname,
"node_modules/prosemirror-model"
),
},
// etc After that, I rebuilt everything and the bug went away :). Unless I'm somehow mistaken about it being the solution (I don't think I am), the reason it went away is because I configured webpack to have every relevant package use only a single version of This is a VERY useful technique if you have multiple interdependent webpack-based packages. It's definitely not the first time I've solved an issue like this using it. My |
I'm in an environment where I have to import prosemirror with a cdn, and I'm getting the same error. What is the workaround here? I'm not even importing prosemirror-model directly. <script type="module">
import * as prosemirrorState from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm';
import * as prosemirrorView from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm';
import * as prosemirrorExampleSetup from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm';
import * as prosemirrorMarkdown from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm';
let schema = prosemirrorMarkdown.schema
class ProseMirrorView {
constructor(target, content) {
this.view = new prosemirrorView.EditorView(target, {
state: prosemirrorState.EditorState.create({
doc: prosemirrorMarkdown.defaultMarkdownParser.parse(content),
plugins: prosemirrorExampleSetup.exampleSetup({schema})
})
})
}
get content() {
return prosemirrorMarkdown.defaultMarkdownSerializer.serialize(this.view.state.doc)
}
focus() { this.view.focus() }
destroy() { this.view.destroy() }
}
window.ProseMirrorView = ProseMirrorView;
</script> |
You would need to make sure that the dep ranges declared by each of these packages import the same prosemirror-model version or else it will import them multiple times. prosemirror-markdown would be my bet on being the odd one out here |
Indeed, I had to change prosemittotMarkdown to 1.12 and view to 1.32, thank you. |
I'm having this issue with latest versions of |
You have to make sure that there are not multiple instances loaded. To check that run: Often it is because two packages declare that they need versions that are incompatible with one another (i.e. one says it needs 1.2 & another that says it needs 1.3) With tiptap packages you should not have that issue because @tiptap/pm bundles all the prosemirror deps together, all tiptap packages should be upgraded together to the same exact version number to guarantee compatibility. If you have any other deps that depend on prosemirror-model then it is up to you to resolve, you can force the packages to resolve to only one version yarn & pnpm have a concept of overrides, you can also force your bundler to only ever resolve a single version with aliasing. All in all there are multiple resolutions to this issue, but they do not stem with tiptap, we have put a lot of effort to make sure you get the right packages. |
This is my dependensies
This trick helped me:
|
why this version? i have the ^2.5.7. Where do I see the best version of the prosemirror? @vedmant |
got this issue with all tiptap packages on version this solved it for me:
I'm using |
Enter key was not working in tiptap. Reason: TipTap internal version conflict. Fixed by using prosemirror-model in resolutions. From here: ueberdosis/tiptap#577 (comment)
Hey guys! I'm trying to use this for CDN for Flowbite but I get the same error. Here's my code:
I tried to add:
As @thacoon mentioned, but I still get the same error. Is there any way we can get this fixed via CDN? I can't use local Yarn versioning because of the nature of our project. I get the error when hitting enter and trying to split a block:
And I also get an error when trying to create a list item:
All of the other commands work. Edit: got it working by adding:
It's a very dirty fix though. |
I'm getting this after upgrading to the latest version 2.7.4. I also tried the proposed solution with using resolutions / overrides but without success. I'm using pnpm. |
2.7.4 is not the latest version, 2.8.0 is PNPM has overrides: https://pnpm.io/package_json#pnpmoverrides |
I had this error with TipTap v2.8.0. It was not a TipTap issue though: Importing types from ProseMirror packages directly can also lead to this error. Make sure to import from Bad:
Good:
|
ueberdosis/tiptap#577 - added activity tabs to change view target in home page's activities
If you are using yarn just |
Describe the bug
When using the editor (e.g. using ENTER key) it's not working, and we got error in the console:
Due to
[email protected]
and[email protected]
loaded simultaneously.tiptap-extensions
package requires strictly version1.8.2
and other packagesprosemirror-model@^1.0.0, prosemirror-model@^1.1.0, prosemirror-model@^1.8.1
which resolves to1.9.0
Steps to Reproduce / Codesandbox Example
Steps to reproduce the behaviour:
with Yarn. This will install
[email protected]
and[email protected]
.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 inpackage.json
:Then remove
node_modules
,yarn.lock
and install packages again.The text was updated successfully, but these errors were encountered: