vue-pdf: Cannot read property 'catch' of undefined
I get an error in the browser when I was using Vue-pdf. The error information
TypeError: Cannot read property 'catch' of undefined
at PDFJSWrapper.renderPage (new.web.c42b3b.js:formatted:72084)
at a.resize (new.web.c42b3b.js:formatted:36592)
at Ht (vendors.web.bebfbe.js:1)
at a.n (vendors.web.bebfbe.js:1)
at Ht (vendors.web.bebfbe.js:1)
at a.t.$emit (vendors.web.bebfbe.js:1)
at a.handler (new.web.c42b3b.js:formatted:36474)
at Ht (vendors.web.bebfbe.js:1)
at dn.run (vendors.web.bebfbe.js:1)
at hn (vendors.web.bebfbe.js:1)
but, This error isn’t caught in the local environment. My code
import pdf from 'vue-pdf/src/vuePdfNoSssNoWorker'
import 'pdfjs-dist/build/pdf.worker.entry.js'
<pdf :src="resumeUrl" v-for="i in pdfPageCountNum" :key="i" :page="i" ></pdf>
Vue-pdf version
"vue-pdf": "^4.0.12",
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 3
- Comments: 20
“pdfjs-dist”: “^2.5.207”, “vue-pdf”: “^4.2.0” 亲测可以解决
After a lot of trial and error this is the only thing that worked for me.
这才是正解,我发现虽然你安装的时候指定的是4.0.0的版本npm i vue-pdf@4.0.0,但是实际上node_modules中安装的还是最新版,删除package-lock.json重新装也不行,只有在package-lock.json中锁定4.0.0的版本才解决
package-lock.json 里面直接锁定到4.0.0版本 “vue-pdf”: “4.0.0”,
Same error occured to me. Thanks to @sztblogs I decreased version to 4.0.0 and it works