【问题标题】:Deploy private repository as dependency将私有存储库部署为依赖项
【发布时间】:2012-04-03 22:39:35
【问题描述】:

我们构建了由三个存储库组成的应用程序:

  1. 前端(这个已经部署)
  2. 共享
  3. 核心

这些都是 GitHub 上的私有 Git 存储库。

我的 package.json 文件的相关部分如下所示:

  "dependencies": {
    "express": "2.5.x",
    "coffeecup": "0.3.x",
    "socket.io": "0.8.x",
    "connect-mongodb": "1.x",
    "app-core": "git+ssh://git@github.com:...git",
    "app-shared": "git+ssh://git@github.com:...git"
  },
  "devDependencies": {
    "mongoskin": "*",
    "bcrypt": "*",
    "libxml-to-js": "0.3.x"
  },
  "bundleDependencies": [
    "app-core",
    "app-shared"
  ],
  "analyze": true

当我部署到 Nodejitsu 时,使其工作的唯一方法是在我部署的存储库的 devDependencies 中拥有 Shared 和 Core 的依赖项,但这似乎是错误的解决方案,因为 devDependencies 用于开发而不是生产。

我也试过Shrinkwrapping,但没有用。

有人知道更好的解决方案吗?

【问题讨论】:

    标签: node.js npm nodejitsu


    【解决方案1】:

    "bundleDependencies" 应该可以工作。当你jitsu deploy 时,它会分析依赖并尝试添加它们,但你可以用--noanalyze 禁用它。如果您在 node_modules/app-corenode_modules/app-shared 中有依赖项,那么我不明白为什么它不起作用。你能告诉我更多信息吗,比如jitsu deploy的输出?

    编辑:哦,我明白了,您将它们放在devDependencies 中,这样它们就不会安装在 Nodejitsu 上。是的,我想你会这样做,除非你只是想将依赖项捆绑为子模块,甚至不将它们包含在 dependenciesdevDependencies 中。

    【讨论】:

      【解决方案2】:

      你只能从你自己的机器上 ssh 到 github。

      将 repo url 从 git+ssh://git@github.com... 更改为 https://github.com/...

      【讨论】:

      • 在 Nodejitsu,你不能拥有你的私有 SSH 密钥,所以无法获取私有代表,因此我需要 bundleDependencies。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-01-03
      • 2017-03-29
      • 2019-02-20
      • 2021-12-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多