I am having a problem with the pdfjs-dist package while building processing. It is showing an error in GitLab build image.
node version ---- v14.19.0
pdfjs-dist version-2.13.313
/app/node_modules/pdfjs-dist/build/pdf.js:2440
return this._jsActionsPromise ||= this._transport.getPageJSActions(this._pageIndex);
^^^
SyntaxError: Unexpected token '||='
at wrapSafe (internal/modules/cjs/loader.js:988:16)
at Module._compile (internal/modules/cjs/loader.js:1036:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/app/node_modules/@react-pdf-viewer/core/lib/cjs/core.min.js:1:94)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10) {
type: 'SyntaxError'
}
Upgrading to node 16 resolved my problem, you might want to try that (if possible, of course):)
Downgrading my package version to 2.9.359 has resolved my problem
I had the same situation, with a locally installed Node v14.x too. I did something similar to Elia. D's answer , but since the binary file is self-contained with its own Node runtime, instead of upgrading my local Node version, I solved it by setting the target to use Node v16.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.