在Meteor中:如何使用应该从存储库中提取的npm库?

在我的packages.json文件中,我有:

{ "sendwithus":"git+https://git@github.com/whalepath/sendwithus_nodejs.git#enable_testing_server" } 

因为我需要使用分叉(和固定版本的库)。 上面的语法在直接节点中工作。 如何在meteor中做到这一点?

这是我得到的错误:

 => Started proxy. => Errors prevented startup: While reading package from `src/packages/npm-container`: package.js:14:7: must declare exact version of dependency: sendwithus@git+https://git@github.com/whalepath/sendwithus_nodejs.git#enable_testing_server 

更新:

我试图删除线,并使用meteor添加到包括包:

失败:

 meteor add sendwithus@2.9.1@https://github.com/whalepath/sendwithus_nodejs/commit/41b0d177f6eabf02de2daec9bb2b36daebbfbef4 => Errors while parsing arguments: While adding package sendwithus@2.9.1@https://github.com/whalepath/sendwithus_nodejs/commit/41b0d177f6eabf02de2daec9bb2b36daebbfbef4: error: Package names can only contain lowercase ASCII alphanumerics, dash, dot, or colon, not "@". 

失败:

 $ meteor add sendwithus@2.9.1_https://github.com/whalepath/sendwithus_nodejs/commit/41b0d177f6eabf02de2daec9bb2b36daebbfbef4 => Errors while parsing arguments: While adding package sendwithus@2.9.1_https://github.com/whalepath/sendwithus_nodejs/commit/41b0d177f6eabf02de2daec9bb2b36daebbfbef4: error: Can't have two _ in version: 2.9.1_https://github.com/whalepath/sendwithus_nodejs/commit/41b0d177f6eabf02de2daec9bb2b36daebbfbef4 

失败:

 $ meteor add server:sendwithus@2.9.1@https://github.com/whalepath/sendwithus_nodejs/commit/41b0d177f6eabf02de2daec9bb2b36daebbfbef4 => Errors while parsing arguments: While adding package server:sendwithus@2.9.1@https://github.com/whalepath/sendwithus_nodejs/commit/41b0d177f6eabf02de2daec9bb2b36daebbfbef4: error: Package names can only contain lowercase ASCII alphanumerics, dash, dot, or colon, not "@". 

失败:

 $ meteor add sendwithus@https://github.com/whalepath/sendwithusnodejs/commit/41b0d177f6eabf02de2daec9bb2b36daebbfbef4 => Errors while parsing arguments: While adding package sendwithus@https://github.com/whalepath/sendwithusnodejs/commit/41b0d177f6eabf02de2daec9bb2b36daebbfbef4: error: Version string must look like semver (eg '1.2.3'), not 'https://github.com/whalepath/sendwithusnodejs/commit/41b0d177f6eabf02de2daec9bb2b36daebbfbef4'. 

基于这个问题的答案,当我发布它来input链接描述在这里 ,唯一的解决办法是创build一个假的meteor包来包装新的节点库。

 Npm.depends({sendwithus: "https://github.com/whalepath/sendwithusnodejs/commit/41b0d177f6eabf02de2daec9bb2b36daebbfbef4"}); 

为了扩展这个答案:只需要使用一个npm库的fork需要:

  1. 包/ sendwithus / main.js:

    SendWithUs = Npm.require('sendwithus');

2. packages / sendwithus / package.js:

 Package.describe({ summary: 'Wrapped sendwithus library', version: '2.9.1', name: 'sendwithus' }); Npm.depends({sendwithus: "https://github.com/whalepath/sendwithus_nodejs/tarball/41b0d177f6eabf02de2daec9bb2b36daebbfbef4"}); Package.onUse(function(api){ api.addFiles('main.js', 'server'); api.export('SendWithUs'); }); 
  1. 删除packages.json中的引用

  2. meteor添加sendwithus

  3. 使用SendWithUsvariables

也许这可以改善?