【发布时间】:2016-05-15 17:04:50
【问题描述】:
是否有可能获得 git 依赖项的更新行为,就像 npm 包一样?
所以我有 git 依赖:
"dependencies": {
"my-module": "github:me/my-module"
}
并且希望每次我做npm install 时都更新它,添加修订哈希是解决方案,但每次在 github 上更新包时都需要做更多的工作来跟踪和更新 package.json 中的 i。
还有 git 标签(也可以使用 npm version.. 命令设置 - 它使用标签 v1.2.3 创建提交。所以我想也许这是在依赖 package.json 中使用此标签的方法?
希望我是清楚的。
repo 上的 git 标签给了我
v1.0.1 v1.0.0 ..
如果我尝试在模块名称版本之后添加 package.json,例如:#1.0.0 或 #v1.0.1
```
"dependencies": {
"my-module": "github:me/my-module#1.0.1"
}
```
安装失败并出现错误:
Command failed: git -c core.longpaths=true rev-list -n1 1.0.0
fatal: ambiguous argument '1.0.0': unknown revision or path not in the
ree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
If you need help, you may report this error at:
<https://github.com/npm/npm/issues>
...
【问题讨论】:
-
如果
git tag为您提供v1.0.0等值,那么您需要使用该确切值。使用1.0.0会失败。