Advanced Customization

Which product are you using?

PDF.js Express Version

Detailed description of issue
I want to start with the advanced customization of the WebViewer. I need custom categories to mark the status of annotations.
I’ve followed the documentation:

I’m using a MacStudio with MacOS 14.3
node.js version: v20.11.0
npm version: 10.4.0

I got a lot of errors:

npm install

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @babel/eslint-parser@7.21.8
npm ERR! Found: eslint@6.8.0
npm ERR! node_modules/eslint
npm ERR! dev eslint@“^6.8.0” from the root project
npm ERR! peer eslint@“>=4.0.0” from eslint-plugin-babel@5.3.1
npm ERR! node_modules/eslint-plugin-babel
npm ERR! dev eslint-plugin-babel@“^5.3.0” from the root project
npm ERR! 6 more (eslint-plugin-cypress, eslint-plugin-import, …)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@“^7.5.0 || ^8.0.0” from @babel/eslint-parser@7.21.8
npm ERR! node_modules/@babel/eslint-parser
npm ERR! dev @babel/eslint-parser@“^7.16.0” from the root project
npm ERR!
npm ERR! Conflicting peer dependency: eslint@8.56.0
npm ERR! node_modules/eslint
npm ERR! peer eslint@“^7.5.0 || ^8.0.0” from @babel/eslint-parser@7.21.8
npm ERR! node_modules/@babel/eslint-parser
npm ERR! dev @babel/eslint-parser@“^7.16.0” from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Next try:

npm start --legacy-peer-deps

result:
npm WARN deprecated domexception@4.0.0: Use your platform’s native DOMException instead
npm WARN deprecated abab@2.0.6: Use your platform’s native atob() and btoa() methods instead
npm WARN deprecated urix@0.1.0: Please see GitHub - lydell/urix: [DEPRECATED] Makes Windows-style paths more unix and URI friendly.
npm WARN deprecated trim@0.0.1: Use String.prototype.trim() instead
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: Array.prototype.sort() - JavaScript | MDN
npm WARN deprecated source-map-url@0.4.1: See GitHub - lydell/source-map-url: [DEPRECATED] Tools for working with sourceMappingURL comments.
npm WARN deprecated source-map-resolve@0.5.3: See GitHub - lydell/source-map-resolve: [DEPRECATED] Resolve the source map and/or sources for a generated file.
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated resolve-url@0.2.1: GitHub - lydell/resolve-url: [DEPRECATED] Like Node.js’ `path.resolve`/`url.resolve` for the browser.
npm WARN deprecated redux-devtools-extension@2.13.9: Package moved to @redux-devtools/extension.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See There’s Math.random(), and then there’s Math.random() · V8 for details.
npm WARN deprecated fsevents@1.2.13: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)

added 2692 packages, and audited 2693 packages in 3m

273 packages are looking for funding
run npm fund for details

131 vulnerabilities (2 low, 89 moderate, 35 high, 5 critical)

npm start

webviewer-ui@10.6.0 start

npx babel-node ./dev-server.js

Listening at localhost:3000 (http://192.168.1.222:3000)
node:internal/crypto/hash:68
this[kHandle] = new _Hash(algorithm, xofLen);
^

Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:68:19)
at Object.createHash (node:crypto:138:10)
at module.exports (…/webviewer-ui/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (…/webviewer-ui/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (…/webviewer-ui/node_modules/webpack/lib/NormalModule.js:471:10)
at …/webviewer-ui/node_modules/webpack/lib/NormalModule.js:503:5
at …/webviewer-ui/node_modules/webpack/lib/NormalModule.js:358:12
at …/webviewer-ui/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (…/webviewer-ui/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at Array. (…/webviewer-ui/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
at Storage.finished (…webviewer-ui/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
at …/webviewer-ui/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
at …/webviewer-ui/node_modules/graceful-fs/graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3) {
opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ],
library: ‘digital envelope routines’,
reason: ‘unsupported’,
code: ‘ERR_OSSL_EVP_UNSUPPORTED’
}

Node.js v20.11.0

Expected behaviour
Complete flawless install and build of provided source code

Does your issue happen with every document, or just one?
yes

Link to document
I’m not able to load any document yet

Hello bart.thijs,

It looks like one of the packages might be out of date, try doing:

npm install --legacy-peer-deps

then

npm run start

Best regards,
Tyler

Hi Tyler,
As you can see in my question, I’ve tried to use the --legacy-peer-deps option but with no sucess.
Is it possible to provide an overview of the tested and approved version of NodeJS and other libraries that should be used. I’ve installed nvm, so i can switch quite easily between different versions.

Kind regards
Bart Thijs

Hello bart.thijs,

You added the --legacy-peer-deps to the npm start command, not the npm install.

Best regards,
Tyler

Thanks, i overlooked that. I’ll give it a try
kind regards,
Bart

Hi Tyler,
I did use this command:

npm install --legacy-peer-deps

I’ve tried several versions of Node.JS. it turns out that 13 seems to give the least error messages.
What is the version of node under which this package should work?

After npm start a browser window is opened but nothing is shown. These are the error message that i see in Edge:

Failed to load resource: the server responded with a status of 404 (Not Found)

Refused to execute script from 'http://localhost:3000/core/webviewer-core.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Similar messages pop up in Firefox

I’m using MacOS 14,3

Currently I’m evaluating the software and its capabilities. I’m building a web-application where annotations and their labels are crucial. I need to be able to use custom labels for annotation in order to move ahead with the purchase of the software.

kind regards

Bart Thijs