当我试图运行pdf2json (根本没有任何参数)时,我得到了以下错误:
/usr/lib/node_modules/pdf2json/lib/p2jcmd.js:63
#continue(callback, err) {
^
SyntaxError: Unexpected token '('
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/usr/lib/node_modules/pdf2json/bin/pdf2json:3:16)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)下面是我试图在其中运行的Dockerfile:
FROM debian:bullseye
RUN apt-get update \
&& apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - \
&& apt-get install -y nodejs \
&& npm install pdf2json -g有什么想法吗?
发布于 2022-03-26 02:56:27
引用https://github.com/modesty/pdf2json/issues/250
这里的问题是,这些更改都是中断的,但是只被标记为一个新的(不破坏的)特性,并有一个较小的版本增量。因此,调用
npm audit fix实际上强制进行了升级,并破坏了一切。这需要重新发布,作为v2.0和/或在1.x行上发布的bug修补程序的主要版本增量,以使其再次向后兼容。
解决方案是执行npm install --save-exact pdf2json@1.2.5。
https://stackoverflow.com/questions/71624279
复制相似问题