[Bug]: Error: Cannot find module '@tiptap/pm/state'
We have a dependabot alert for the package Flat and to update this package, we need to update adminjs to at least 6.7.6. We are upgrading from 5.0.0 and this was not an issue with that version.
When attempting to start the project, we get the following error:
[ERROR] 16:17:00 Error: Cannot find module '@tiptap/pm/state'
Require stack:
- /home/node/app/node_modules/@tiptap/core/dist/index.cjs
- /home/node/app/node_modules/@tiptap/starter-kit/dist/index.cjs
- /home/node/app/node_modules/@adminjs/design-system/build/molecules/rich-text-editor/rich-text-editor.js
- /home/node/app/node_modules/@adminjs/design-system/build/molecules/rich-text-editor/index.js
- /home/node/app/node_modules/@adminjs/design-system/build/index.js
- /home/node/app/node_modules/adminjs/lib/backend/utils/custom-views/get-component-html.js
- /home/node/app/node_modules/adminjs/lib/backend/utils/custom-views/index.js
- /home/node/app/node_modules/adminjs/lib/backend/utils/index.js
- /home/node/app/node_modules/adminjs/lib/backend/adapters/resource/base-resource.js
- /home/node/app/node_modules/adminjs/lib/backend/utils/resources-factory/resources-factory.js
- /home/node/app/node_modules/adminjs/lib/adminjs.js
- /home/node/app/node_modules/adminjs/lib/index.js
- /home/node/app/node_modules/adminjs/index.js
- /home/node/app/src/adminjs/index.ts
- /home/node/app/src/app.ts
Also note that after deleting the node_modules folder and running yarn I see the following warnings output:
warning " > @adminjs/[email protected]" has incorrect peer dependency "tslib@^2.3.1".
warning " > @adminjs/[email protected]" has incorrect peer dependency "typeorm@~0.3.0".
warning "adminjs > @adminjs/design-system > @tiptap/react > @tiptap/[email protected]" has incorrect peer dependency "@tiptap/core@^2.0.0".
warning "adminjs > @adminjs/design-system > @tiptap/react > @tiptap/[email protected]" has incorrect peer dependency "@tiptap/pm@^2.0.0".
warning "adminjs > @adminjs/design-system > @tiptap/react > @tiptap/[email protected]" has incorrect peer dependency "@tiptap/core@^2.0.0".
warning "adminjs > @adminjs/design-system > @tiptap/react > @tiptap/[email protected]" has incorrect peer dependency "@tiptap/pm@^2.0.0".
warning "adminjs > @adminjs/design-system > @tiptap/starter-kit > @tiptap/[email protected]" has incorrect peer dependency "@tiptap/pm@^2.0.0".
warning "adminjs > @adminjs/design-system > @tiptap/starter-kit > @tiptap/[email protected]" has incorrect peer dependency "@tiptap/pm@^2.0.0".
warning "adminjs > @adminjs/design-system > @tiptap/starter-kit > @tiptap/[email protected]" has incorrect peer dependency "@tiptap/pm@^2.0.0".
warning "adminjs > @adminjs/design-system > @tiptap/starter-kit > @tiptap/[email protected]" has incorrect peer dependency "@tiptap/pm@^2.0.0".
warning "adminjs > @adminjs/design-system > @tiptap/starter-kit > @tiptap/[email protected]" has incorrect peer dependency "@tiptap/pm@^2.0.0".
warning "adminjs > @adminjs/design-system > @tiptap/starter-kit > @tiptap/[email protected]" has incorrect peer dependency "@tiptap/pm@^2.0.0".
yarn.lock entries for adminJs:
"@adminjs/design-system@^3.1.6":
version "3.1.8"
resolved "https://registry.yarnpkg.com/@adminjs/design-system/-/design-system-3.1.8.tgz#41a561ae3723c46065abd82be6aa2f51fa015a1a"
integrity sha512-M0l8NXoHKFoJ9XLv6BkrgRPnE0hCYNYWVNiQKA4qOpzifB2LAPAViqQ36Qyxgz1mL9nnzl7OJpGlb8cHSrIajg==
dependencies:
"@carbon/icons-react" "^11.8.0"
"@hypnosphi/create-react-context" "^0.3.1"
"@tiptap/core" "2.0.0-beta.217"
"@tiptap/extension-bubble-menu" "2.0.0-beta.217"
"@tiptap/extension-character-count" "2.0.0-beta.217"
"@tiptap/extension-code" "2.0.0-beta.217"
"@tiptap/extension-document" "2.0.0-beta.217"
"@tiptap/extension-floating-menu" "2.0.0-beta.217"
"@tiptap/extension-heading" "2.0.0-beta.217"
"@tiptap/extension-image" "2.0.0-beta.217"
"@tiptap/extension-link" "2.0.0-beta.217"
"@tiptap/extension-table" "2.0.0-beta.217"
"@tiptap/extension-table-cell" "2.0.0-beta.217"
"@tiptap/extension-table-header" "2.0.0-beta.217"
"@tiptap/extension-table-row" "2.0.0-beta.217"
"@tiptap/extension-text" "2.0.0-beta.217"
"@tiptap/extension-text-align" "2.0.0-beta.217"
"@tiptap/extension-typography" "2.0.0-beta.217"
"@tiptap/pm" "2.0.0-beta.217"
"@tiptap/react" "2.0.0-beta.217"
"@tiptap/starter-kit" "2.0.0-beta.217"
date-fns "2.15.0"
jw-paginate "^1.0.4"
lodash "^4.17.20"
polished "^3.6.5"
react-currency-input-field "^3.6.5"
react-datepicker "^4.8.0"
react-phone-input-2 "^2.15.1"
react-select "^5.2.2"
react-text-mask "^5.4.3"
styled-system "^5.1.5"
text-mask-addons "^3.8.0"
"@adminjs/express@^5.1.0":
version "5.1.0"
resolved "https://registry.yarnpkg.com/@adminjs/express/-/express-5.1.0.tgz#a62969ff28ef51ca344f54dfac20a1dbff2c2a07"
integrity sha512-+mrtDmoAYA9R+/FTYWOLL48g005yrgcAWC2phdwqGzznIxGKSp2YERcfzdTI7Svtnlaal72/QW8Q3OhzJjVLzQ==
dependencies:
path-to-regexp "^6.2.0"
"@adminjs/passwords@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@adminjs/passwords/-/passwords-3.0.1.tgz#48ca32b11d59744a4a757b98f15daa8f105c8954"
integrity sha512-gmHUuA+tV1oRFlpGp30fXO5HZmI1kh2L9I0ZS9Lih1a1jMOhyLsv9slHLYtuYEd/QGdmUbK2Y0daDbUD5Qu2DA==
"@adminjs/typeorm@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@adminjs/typeorm/-/typeorm-4.0.0.tgz#60bc199eee2e5bfe9a132aa997f606b7505cf5e7"
integrity sha512-mo0fc5AmuuV2JxYkf6t6eSdKE6W17qfQX43C4vt12skItR3FrNU7tJ9wlD6ZgzbsRpa2e+ayVpjttJb2VxPQYQ==
[email protected]:
version "6.7.6"
resolved "https://registry.yarnpkg.com/adminjs/-/adminjs-6.7.6.tgz#f755a8b63eaa591e61f4f6e1ab434556060e4739"
integrity sha512-dt+xALdtE/OkrbaKooxdXnA/0cufk0HhYZ7U0R4RVq21etefSCkpauBbu49ZyfgBdmO3uc7IwJI/O6KcCn4kew==
dependencies:
"@adminjs/design-system" "^3.1.6"
"@babel/core" "^7.10.2"
"@babel/parser" "^7.10.2"
"@babel/plugin-transform-runtime" "^7.10.1"
"@babel/polyfill" "^7.10.1"
"@babel/preset-env" "^7.16.4"
"@babel/preset-react" "^7.10.1"
"@babel/preset-typescript" "^7.10.1"
"@babel/register" "^7.10.1"
"@hello-pangea/dnd" "^16.0.0"
"@rollup/plugin-babel" "^5.2.1"
"@rollup/plugin-commonjs" "^22.0.1"
"@rollup/plugin-json" "^4.1.0"
"@rollup/plugin-node-resolve" "^13.3.0"
"@rollup/plugin-replace" "^2.3.3"
"@types/babel-core" "^6.25.7"
"@types/react" "^18.0.8"
axios "^0.27.2"
babel-plugin-styled-components "^1.11.1"
commander "^5.1.0"
flat "5.0.1"
i18next "^21.9.2"
lodash "^4.17.21"
ora "^5.4.1"
prop-types "^15.7.2"
punycode "^2.1.1"
react "^18.1.0"
react-dom "^18.1.0"
react-i18next "^11.18.6"
react-is "^18.1.0"
react-redux "^8.0.2"
react-router "^6.3.0"
react-router-dom "^6.3.0"
redux "^4.2.0"
rollup "^2.79.1"
rollup-plugin-terser "^7.0.2"
slash "^3.0.0"
styled-components "^5.3.5"
uuid "^8.3.2"
xss "^1.0.13"
package.json deps and dev-deps:
"dependencies": {
"@adminjs/express": "^5.1.0",
"@adminjs/passwords": "^3.0.1",
"@adminjs/typeorm": "^4.0.0",
"@apollo/client": "^3.4.7",
"@types/express": "^4.17.17",
"adminjs": "6.7.6",
"axios": "^0.21.2",
"bcrypt": "^5.0.1",
"class-transformer": "^0.4.0",
"class-validator": "^0.14.0",
"connect-redis": "^6.0.0",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"dayjs": "^1.10.6",
"deepmerge": "^4.2.2",
"dotenv": "^10.0.0",
"express": "^4.17.3",
"express-formidable": "^1.2.0",
"express-jwt": "^6.0.0",
"express-session": "^1.17.3",
"file-saver": "^2.0.5",
"flat": "^5.0.2",
"graphql": "^15.5.1",
"js-cookie": "^3.0.1",
"jsonwebtoken": "^9.0.0",
"lodash": "^4.17.21",
"mysql": "^2.18.1",
"react-color": "^2.19.3",
"react-select": "^4.3.1",
"redis": "^3.1.2",
"reflect-metadata": "^0.1.13",
"styled-components": "^5.3.9",
"ts-node-dev": "^1.1.6",
"tslib": "~2.2.0",
"typeorm": "^0.2.37",
"uuid": "^8.3.2"
},
"devDependencies": {
"@types/jest": "~26.0.23",
"@types/node": "~14.14.45",
"@types/react": "^17.0.13",
"@types/styled-components": "^5.1.26",
"@typescript-eslint/eslint-plugin": "~4.25.0",
"@typescript-eslint/parser": "~4.25.0",
"eslint": "~7.27.0",
"eslint-config-prettier": "~8.3.0",
"eslint-plugin-jest": "~24.3.6",
"jest": "~27.0.3",
"prettier": "~2.3.0",
"rimraf": "~3.0.2",
"ts-jest": "~27.0.2",
"tsutils": "~3.21.0",
"typescript": "~4.3.2"
},
"resolutions": {
"@types/react": "^17.0.13"
}
there isn't much else in the package.json file, scripts and the standards (name, version, author...)
I've updated adminJs all the way to the last versions before the v7.0.0 betas start. I cannot update to 7 as it requires a node version bump that we are unable to do ATM. I get the same error across the board.
Please advice on how best to address this? It is required that we get the Flat package updated and cannot do so.
Note: This seems related to https://github.com/ueberdosis/tiptap/issues/3689
Adding "@tiptap/core": "^2.0.1" to the package.json resolutions section has gotten us past this current issue.
This probably happened because TipTap went out of beta and their packages installed multiple versions of themselves... I suggest moving their other packages to resolutions as well:
"@tiptap/core": "2.0.1",
"@tiptap/extension-bubble-menu": "2.0.1",
"@tiptap/extension-character-count": "2.0.1",
"@tiptap/extension-code": "2.0.1",
"@tiptap/extension-document": "2.0.1",
"@tiptap/extension-floating-menu": "2.0.1",
"@tiptap/extension-heading": "2.0.1",
"@tiptap/extension-image": "2.0.1",
"@tiptap/extension-link": "2.0.1",
"@tiptap/extension-table": "2.0.1",
"@tiptap/extension-table-cell": "2.0.1",
"@tiptap/extension-table-header": "2.0.1",
"@tiptap/extension-table-row": "2.0.1",
"@tiptap/extension-text": "2.0.1",
"@tiptap/extension-text-align": "2.0.1",
"@tiptap/extension-typography": "2.0.1",
"@tiptap/pm": "2.0.1",
"@tiptap/react": "2.0.1",
"@tiptap/starter-kit": "2.0.1",
Thanks for the recommendation @dziraf !
Do we have any plan for the next release include a updated package.json? For some need a workaround fix, just add a resolution to your package.json
{
"resolutions": {
"@tiptap/core": "2.0.3",
"@tiptap/pm": "2.0.3",
"@tiptap/starter-kit": "2.0.3"
}
}
Maybe I'm responding too late, but to add to the discussion:
I noticed that the error only happens when I install the dependencies with Yarn. With NPM it works just fine