modesty / pdf2json

converts binary PDF to JSON and text, for server-side PDF processing and command-line use.
https://github.com/modesty/pdf2json
Other
1.99k stars 378 forks source link

ERR_UNKNOWN_FILE_EXTENSION, ES module cli error #296

Closed magicdawn closed 1 year ago

magicdawn commented 1 year ago

when using in cli

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for /Users/magicdawn/Library/pnpm/global/5/.pnpm/pdf2json@3.0.3/node_modules/pdf2json/bin/pdf2json. Loading extensionless files is not supported inside of "type":"module" package.json contexts. The package.json file /Users/magicdawn/Library/pnpm/global/5/.pnpm/pdf2json@3.0.3/node_modules/pdf2json/package.json caused this "type":"module" context. Try changing /Users/magicdawn/Library/pnpm/global/5/.pnpm/pdf2json@3.0.3/node_modules/pdf2json/bin/pdf2json to have a file extension. Note the "bin" field of package.json can point to a file with an extension, for example {"type":"module","bin":{"pdf2json":"./bin/pdf2json.js"}}

looks like bin/pdf2json has to change to bin/pdf2json.js

env

node: latest lts v18.14.1 pkg: latest v3.0.3

modesty commented 1 year ago

corrected by commit 50f21a6