【问题标题】:Is it possible to clone the git repositories when installing NPM packages from git?从 git 安装 NPM 包时是否可以克隆 git 存储库?
【发布时间】:2015-05-03 00:42:07
【问题描述】:

我有一个这样的package.json

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "dependencies": {
      "some-module": "git+ssh://git@github.com/IonicaBizau/some-module.git"
  },
  "author": "",
  "license": "ISC"
}

当我执行npm install 时,一切都已正确安装,但我也想通过克隆存储库来安装我的存储库中的包,所以在node_modules/some-module 中,我将从 GitHub 克隆一个 git 存储库。

我该怎么做?是否有内置选项或者我应该构建自己的工具?

【问题讨论】:

    标签: node.js git github npm


    【解决方案1】:

    我创建了gpm - 一个从 git 安装依赖项的工具。

    git + npm === gpm


    要安装 gpm,请执行以下操作:

    npm i -g gpm
    

    那么你可以这样做:

    gpm -i some-module
    

    这将从 git 存储库中递归安装依赖项。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-08
      • 2018-03-07
      • 2013-06-04
      • 1970-01-01
      • 2013-07-14
      • 1970-01-01
      • 2019-09-16
      相关资源
      最近更新 更多