javascript - 无法安装 jspdf 1.5.3

标签 javascript reactjs npm jspdf html2canvas

我需要将 html 转换为 pdf,我使用的是 jspdf 1.5.2。 它显示错误 Cannot read property 'charAt' of undefined (using with 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 

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

最佳答案

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

关于javascript - 无法安装 jspdf 1.5.3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56440567/

相关文章:

javascript - jQuery hasClass 不起作用或 if 语句有缺陷

javascript - 从另一个组件重新渲染组件的一部分

javascript - React setState回调执行顺序

node.js - 如何 cd 到文件夹并使用 git hook post-receive 运行 npm start ?

npm - 有什么办法可以避免 fsevents 警告?

reactjs - 从 './App' 导入应用程序;

javascript - 如何使用 moment.js/Javascript 列出 2 个时间戳之间的二月月份数?

javascript - 在窗口调整大小时动态更改 div jquery 的高度

javascript - 如何在 React 中使用 Bootstrap 工具提示?

reactjs - Material UI select throws event.target.getAttribute 在react-datatable-component 中使用时不是一个函数