node.js - npm 如何引用github上的依赖包?

查看:717
本文介绍了node.js - npm 如何引用github上的依赖包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

开发配置是vuejs+element-ui,由于项目有些特殊功能,element-ui无法完全满足,我就fork了一份element-ui,并做了一些改动。
之后我在package.json 中引入我的自定义代码:

"dependencies": {
    "element-ui": "git+https://github.com/xbb-web/element.git"
}

然后执行npm install,发现node-modules/element-ui/下并没有包含项目中的全部代码,只有如下几个文件:src,package,LICENSE,package.json,README.md ,为什么?
请问我要如何把项目中的其他代码download下来?

解决方案

找到了解决方法,url后面跟上tag就好了。遇到问题还是要找官方文档,后续我会写一篇详细的文章来记录我此次的自定义element-ui经历吧。

Git urls can be of the form:

git://github.com/user/project.git#commit-ish
git+ssh://user@hostname:project.git#commit-ish
git+http://user@hostname/project/...
git+https://user@hostname/project...
The commit-ish can be any tag, sha, or branch which can be supplied as an argument to git checkout. The default is master.

参考资料:https://docs.npmjs.com/how-np...

这篇关于node.js - npm 如何引用github上的依赖包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆