vue-pdf
vue-pdf copied to clipboard
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",
我也出现你这种情况了,我把版本降到4.0.0 就不会出现这个 Cannot read property 'catch' of undefined 问题了
@sztblogs 谢谢 我试试
@sztblogs 不行 4.0.0不知道怎么找不带worker的版本,我不能带worker的,带worker在生产环境跨域
Same error occured to me. Thanks to @sztblogs I decreased version to 4.0.0 and it works
可以参照这个回答 安装2.7版本的pdfjs-dist https://github.com/FranckFreiburger/vue-pdf/issues/314 我安装后 这个报错消失了
@qq9694526 我这里指定pdfjs-dist版本 在本地环境没问题,在预上线环境报错
new:1 Uncaught (in promise) n {message: "The API version \"2.6.347\" does not match the Worker version \"2.5.207\".", name: "n", details: "[object Object]"}
我在生产环境试了一下 没有出现你讲的这种问题 你看一下是不是别的地方影响的
我也是,之前出现你这个问题了,然后降到4.0.0就行了。
Same issue...
亲测~4.2.0可以
"pdfjs-dist": "^2.5.207", "vue-pdf": "^4.2.0" 亲测可以解决
"pdfjs-dist": "^2.5.207", "vue-pdf": "^4.2.0" 亲测可以解决
4.2.0和4.0.0都不能解决
"pdfjs-dist": "^2.5.207",
"vue-pdf": "^4.0.12",
After a lot of trial and error this is the only thing that worked for me.
Reverting to an older version is not a solution, it's more like a workaround.
@Gourdbaby Does the issue affect the user experience or it's just a console error?
package-lock.json 里面直接锁定到4.0.0版本 "vue-pdf": "4.0.0",
package-lock.json 里面直接锁定到4.0.0版本 "vue-pdf": "4.0.0",
这才是正解,我发现虽然你安装的时候指定的是4.0.0的版本npm i [email protected],但是实际上node_modules中安装的还是最新版,删除package-lock.json重新装也不行,只有在package-lock.json中锁定4.0.0的版本才解决
"pdfjs-dist": "2.5.207", "vue-pdf": "4.2.0" 锁定这两个版本完美解决
Same Issue on 4.3.0, but only on iOS / iPadOS Devices.
I had the same issue, resolved it by downgrading
"vue-pdf": "^4.0.0", "pdfjs-dist": "^2.5.207",
and did npm clean-install
Thanks for leads