我想使用vue-pdf操作pdf文件但是我npm i vue-pdf 报错了
npm run serve
ERROR Failed to compile with 1 error 11:59:19
error in ./node_modules/vue-pdf/node_modules/pdfjs-dist/es5/build/pdf.worker.js
Syntax Error: Error: MainTemplate.hooks.hotBootstrap has been removed (use your own RuntimeModule instead)
ERROR in ./node_modules/vue-pdf/node_modules/pdfjs-dist/es5/build/pdf.worker.js (./node_modules/vue-pdf/node_modules/worker-loader/dist/cjs.js!./node_modules/vue-pdf/node_modules/pdfjs-dist/es5/build/pdf.worker.js)
Module build failed (from ./node_modules/vue-pdf/node_modules/worker-loader/dist/cjs.js):
Error: MainTemplate.hooks.hotBootstrap has been removed (use your own RuntimeModule instead)
at Object.tap (E:\公司项目\安云印\study\anyunyins\node_modules\webpack\lib\MainTemplate.js:215:12)
at WebWorkerMainTemplatePlugin.apply (E:\公司项目\安云印\study\anyunyins\node_modules\vue-pdf\node_modules\webpack\lib\webworker\WebWorkerMainTemplatePlugin.js:139:35)
at E:\公司项目\安云印\study\anyunyins\node_modules\vue-pdf\node_modules\webpack\lib\webworker\WebWorkerTemplatePlugin.js:16:39
at Hook.eval [as call] (eval at create (E:\公司项目\安云印\study\anyunyins\node_modules\tapable\lib\HookCodeFactory.js:19:10), :7:1)
at Hook.CALL_DELEGATE [as _call] (E:\公司项目\安云印\study\anyunyins\node_modules\tapable\lib\Hook.js:14:14)
at Compiler.newCompilation (E:\公司项目\安云印\study\anyunyins\node_modules\webpack\lib\Compiler.js:1121:30)
at E:\公司项目\安云印\study\anyunyins\node_modules\webpack\lib\Compiler.js:1166:29
at Hook.eval [as callAsync] (eval at create (E:\公司项目\安云印\study\anyunyins\node_modules\tapable\lib\HookCodeFactory.js:33:10), :24:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (E:\公司项目\安云印\study\anyunyins\node_modules\tapable\lib\Hook.js:18:14)
at Compiler.compile (E:\公司项目\安云印\study\anyunyins\node_modules\webpack\lib\Compiler.js:1161:28)
@ ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./node_modules/vue-pdf/src/vuePdfNoSss.vue?vue&type=script&lang=js& 9:22-81
@ ./node_modules/vue-pdf/src/vuePdfNoSss.vue?vue&type=script&lang=js& 1:0-179 1:195-198 1:200-376 1:200-376
@ ./node_modules/vue-pdf/src/vuePdfNoSss.vue 2:0-63 3:0-58 3:0-58 10:2-8
@ ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/viewer/index.vue?vue&type=script&lang=js& 1:0-26 4:4-7
@ ./src/views/viewer/index.vue?vue&type=script&lang=js& 1:0-205 1:221-224 1:226-428 1:226-428
@ ./src/views/viewer/index.vue 2:0-57 3:0-52 3:0-52 10:2-8
@ ./src/router/index.js 3:0-37 8:13-19
@ ./src/main.js 3:0-30 7:2-8
webpack compiled with
我试过重新安装,或者固定版本号 ,都不行,有没有朋友们能帮我解惑,能够使用vue-pdf
同一样问题 要疯了
vue3吗?
https://github.com/JBtje/vue3pdf
看一下这个对vue2和3两个版本的使用方式,应该是不同的,我记得版本号也是对应了两个版本
npm i vue-pdf
changed 2 packages, and audited 1278 packages in 39s
99 packages are looking for funding
run npm fund
for details
5 high severity vulnerabilities
To address all issues, run:
npm audit fix
Run npm audit
for details.
PS E:\tryTest\test> npm audit fix
up to date, audited 1278 packages in 5s
99 packages are looking for funding
run npm fund
for details
glob-parent <5.1.2
Severity: high
glob-parent before 5.1.2 vulnerable to Regular Expression Denial of Service in enclosure regex - https://github.com/advisories/GHSA-ww39-953v-wcq6
fix available via npm audit fix
node_modules/watchpack-chokidar2/node_modules/glob-parent
chokidar 1.0.0-rc1 - 2.1.8
Depends on vulnerable versions of glob-parent
node_modules/watchpack-chokidar2/node_modules/chokidar
watchpack-chokidar2 *
Depends on vulnerable versions of chokidar
node_modules/watchpack-chokidar2
watchpack 1.7.2 - 1.7.5
Depends on vulnerable versions of watchpack-chokidar2
node_modules/vue-pdf/node_modules/watchpack
webpack 4.44.0 - 4.46.0
Depends on vulnerable versions of watchpack
node_modules/vue-pdf/node_modules/webpack
5 high severity vulnerabilities
To address all issues, run:
npm audit fix
我后来根据npm官方文档下载之后出现漏洞,修复之后还是不能用
请问一下这个报错解决了吗
博主你好,请问这个问题怎么解决?
怎么解决啊 有没有人帮帮 一样的报错Syntax Error: Error: MainTemplate.hooks.hotBootstrap has been removed (use your own RuntimeModule instead)
同样问题 解决了么楼主