我可以在nodejitsu实例上进行npm链接吗?

时间:2012-02-16 05:44:35

标签: node.js npm nodejitsu

我正在尝试使用我需要安装的lib,然后使用npm进行链接。我没有看到使用jitsu cli以这种方式访问​​我的服务器的任何明确路径。我该怎么做呢?

2 个答案:

答案 0 :(得分:8)

我为nodejitsu工作。

首先,我相信您的问题可以通过在package.json中使用bundledDependencies来解决,如下所示:

{
  "bundledDependencies": [ "myModule", "myFork" ]
}

然后,当jitsu捆绑您的应用程序进行部署(使用npm)时,它还会将您的依赖项与它捆绑在一起。

如果包在github上的项目的个人分支上,npm也可以直接从git url中提取。查看http://npmjs.org/doc/以获取有关从非注册表源提取npm模块的方法的更多信息。

另外:我们有专门的支持团队,可以通过support@nodejitsu.com或irc.freenode.net上的#nodejitsu联系。

答案 1 :(得分:0)

您是否尝试过以编程方式使用npm?文档给出了以下示例:

var npm = require("npm")
npm.commands.install(["some", "args"], function (er, data) {
  if (er) return commandFailed(er)
  // command succeeded, and data might have some info
})

您可以在此处找到完整的文档:https://github.com/isaacs/npm/blob/master/README.md

所以在你的情况下,你可能会这样做:(在伪代码中)

npm.commands.install(['mylibarary'], function(er, data) {
   if (er) { throw Error(); }
   npm.commands.link( ... args ... function(er, data) {
       ... happy amazing awesome ...
   });
});

你也应该去IRC房间。那里的人非常乐于助人。

相关问题