vue2项目中安装富文本 tinymce 插件报错解决方法

我有一个vue2 Ant Design Pro 的项目,安装富文本tinymce 插件时报错,我用的是兼容vue2 的tinymce 版本,还是报错

我安装的tinymce版本如下

javascript 复制代码
npm install --save @tinymce/tinymce-vue@^3.0.1
npm install --save tinymce@^5.1.0
javascript 复制代码
PS D:\work\frontend\admin> npm install --save @tinymce/tinymce-vue@^3.0.1
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: eslint-plugin-vue@5.2.3
npm error Found: eslint@7.32.0
npm error node_modules/eslint
npm error   peer eslint@">= 4.12.1" from babel-eslint@10.1.0
npm error   node_modules/babel-eslint
npm error     dev babel-eslint@"^10.1.0" from the root project
npm error   peer eslint@">=5.0.0" from eslint-config-standard@12.0.0
npm error   node_modules/eslint-config-standard
npm error     eslint-config-standard@"^12.0.0" from @vue/eslint-config-standard@4.0.0
npm error     node_modules/@vue/eslint-config-standard
npm error       dev @vue/eslint-config-standard@"^4.0.0" from the root project
npm error   7 more (eslint-plugin-es, eslint-plugin-node, ...)
npm error
npm error Could not resolve dependency:
npm error peer eslint@"^5.0.0" from eslint-plugin-vue@5.2.3
npm error node_modules/eslint-plugin-vue
npm error   dev eslint-plugin-vue@"^5.2.3" from the root project
npm error
npm error Conflicting peer dependency: eslint@5.16.0
npm error node_modules/eslint
npm error   peer eslint@"^5.0.0" from eslint-plugin-vue@5.2.3
npm error   node_modules/eslint-plugin-vue
npm error     dev eslint-plugin-vue@"^5.2.3" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error C:\Users\shiqiaoyun\AppData\Local\npm-cache\_logs\2025-07-18T06_34_31_835Z-eresolve-report.txt
npm error A complete log of this run can be found in: C:\Users\shiqiaoyun\AppData\Local\npm-cache\_logs\2025-07-18T06_34_31_835Z-debug-0.log

解决方法:采用兼容模式安装

javascript 复制代码
npm install @tinymce/tinymce-vue@3.0.1 --legacy-peer-deps
npm install tinymce@5.1.0 --save --legacy-peer-deps

最终成功安装:

javascript 复制代码
PS D:\work\frontend\admin> npm install @tinymce/tinymce-vue@3.0.1 --legacy-peer-deps

added 1 package, and audited 1859 packages in 19s

240 packages are looking for funding
  run `npm fund` for details

46 vulnerabilities (4 low, 8 moderate, 33 high, 1 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
PS D:\work\frontend\admin> npm install tinymce@5.1.0 --save --legacy-peer-deps

added 1 package, and audited 1860 packages in 8s

240 packages are looking for funding
  run `npm fund` for details

47 vulnerabilities (4 low, 8 moderate, 34 high, 1 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
PS D:\work\frontend\admin>