【问题标题】:Git repository to a dependency in package.jsonGit 存储库到 package.json 中的依赖项
【发布时间】:2016-07-04 20:31:34
【问题描述】:

我有一个 git 存储库,并希望将此存储库用作其他项目的 package.json 文件中的依赖项,以便在我们运行 npm 命令时可以下载它。 谁能帮帮我?

【问题讨论】:

    标签: angularjs git reactjs repository package.json


    【解决方案1】:

    试试这个。

    "dependencies": {
        "<repo>": "<user>/<repo>#<branch>",
    }
    

    例子:

    "dependencies": {
       "botkit": "jonchurch/botkit#master",
    }
    

    Reference is here!

    【讨论】:

      【解决方案2】:

      来自NPM docs

      Git URL 作为依赖项

      git://github.com/user/project.git#commit-ish
      git+ssh://user@hostname:project.git#commit-ish
      git+ssh://user@hostname/project.git#commit-ish
      git+http://user@hostname/project/blah.git#commit-ish
      git+https://user@hostname/project/blah.git#commit-ish
      

      【讨论】:

      • 你能详细说明一下吗?
      【解决方案3】:

      在您的package.json 中尝试以下格式:

      "dependencies" : {
        "projectName" : "git://github.com/user/project.git"
      }
      

      【讨论】:

      • 无法安装 /tmp/npm-14485-f3914b67/git-cache-5670ae183f1b/efb22ee81642ce5f041c7e9f0e793c5618f569cf 这个错误来了
      猜你喜欢
      • 1970-01-01
      • 2021-03-17
      • 2014-06-06
      • 2013-03-22
      • 1970-01-01
      • 2015-03-05
      • 2020-09-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多