根据 package.json 定义分支和标签

Defining both branch and tag in dependancy of package.json

我在 package.json 中使用 Github 存储库作为依赖项,格式如下:

"dependencies": {
  "name": "https://github.com/user/repo.git#branch"
}

不过,我还想从该分支指定 v1.4.0 标记。这个可以吗,怎么写?

NPM documentation 解释了使用 分支或带有 # 的标签,但不能同时使用两者。

您的 git 依赖项可以是提交 ID 的 sha1。

http://www.devthought.com/2012/02/17/npm-tricks/