简体   繁体   English

来自github的NodeJS package.json依赖项

[英]NodeJS package.json dependency from github

I have a nodejs project, and a dependency: 我有一个nodejs项目和一个依赖项:

https://github.com/MrRio/jsPDF https://github.com/MrRio/jsPDF

Usually i used package.json for manage my dependencies, but jsPDF isnt in npm, can i download it from github directly in package.json? 通常我使用package.json来管理我的依赖关系,但是jsPDF在npm中不是,我可以直接从github中的package.json中下载它吗?

You sure can. 你当然可以。

You can specify the repository as username/repo or use a full URL such as 您可以将存储库指定为username/repo存储库,或使用完整的URL,例如

git://github.com/user/project.git

So in your case it'd be 所以在你的情况下

"dependencies": {
  "jsPDF": "MrRio/jsPDF"
}

Also jsPDF is a client-side dependency. jsPDF也是客户端依赖项。 Meaning it won't work in Node.js and will only work in the browser, which is why it isn't in NPM, because it's not a Node.js module. 这意味着它不能在Node.js中工作,而只能在浏览器中工作,这就是为什么它不在NPM中的原因,因为它不是Node.js模块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM