无法安装jspdf 1.5.3

Abd*_*had 6 javascript npm html2canvas jspdf reactjs

我需要将html转换为pdf,而我正在使用jspdf 1.5.2。它显示错误“无法读取未定义的属性'charAt'(与html2canvas一起使用)。

当我尝试安装jspdf 1.5.3时,我得到了:

npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/eligrey/FileSaver.js.git
npm ERR! enoent 
npm ERR! enoent 
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
Run Code Online (Sandbox Code Playgroud)

我已经阅读了其他主题,但没有一个对您有帮助。

Grm*_*mbl 6

在jsPDF版本1.5.3中,他们直接从GitHUB使用依赖项。我假设您正在CI中运行构建?您可以安装git + ssh或在那时返回jsPDF 1.5.2版。他们的错误跟踪器中存在很多问题。这似乎是相关的问题https://github.com/MrRio/jsPDF/issues/2208。它被标记为固定,但是到目前为止没有新版本1.5.4。


小智 5

尝试在git bash(GIT 命令行)中安装 jspdf使用

npm 我 jspdf