mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
48.37k stars 9.97k forks source link

[Bug]: pdf.js/gulpfile.mjs:17 #18733

Closed yuhp-zts closed 1 month ago

yuhp-zts commented 1 month ago

Attach (recommended) or Link to PDF file

not yet this step

Web browser and its version

Chrome windows

Operating system and its version

4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

PDF.js version

master

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem

When I run the npx gulp server command, an error occurs.

What is the expected behavior?

image

What went wrong?

When I run the npx gulp server command, an error occurs.

import { ^

SyntaxError: Unexpected token { at Module._compile (internal/modules/cjs/loader.js:723:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at requireOrImport (/home/yuhp/llm_work/pdf.js/node_modules/gulp-cli/lib/shared/require-or-import.js:20:11) at execute (/home/yuhp/llm_work/pdf.js/node_modules/gulp-cli/lib/versioned/^5.0.0/index.js:35:3) at onExecute (/home/yuhp/llm_work/pdf.js/node_modules/gulp-cli/index.js:230:24)

Link to a viewer

No response

Additional context

No response

Snuffleupagus commented 1 month ago

Web browser and its version

Chrome windows

(This lacks the required version number.)

Note that the gulpfile runs in Node.js, hence providing that version number would have been helpful since the browser isn't really relevant for this issue.

When I run the npx gulp server command, an error occurs.

import { ^

SyntaxError: Unexpected token { [...]

This would most likely suggest that you're using a very old and thus outdated Node.js version. Currently we support Node.js 18+, as documented in https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support