在我的packages.json文件中,我有:
{
"sendwithus":"git+https://git@github.com/whalepath/sendwithus_nodejs.git#enable_testing_server"
}
因为我需要使用分叉(和固定版本的库)。以上语法适用于直接节点。如何在流星中做到这一点?
这是我得到的错误:
=> 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 add来获取包:
失败:
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'.
答案 0 :(得分:1)
基于这个问题的答案,当我将其发布到enter link description here时,唯一的解决方案是创建一个假的meteor包来包装新的节点库。
Npm.depends({sendwithus: "https://github.com/whalepath/sendwithusnodejs/commit/41b0d177f6eabf02de2daec9bb2b36daebbfbef4"});
扩展这个答案: 只是使用npm库的fork需要:
包/ sendwithus / main.js:
SendWithUs = Npm.require('sendwithus');
2。 包/ 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');
});
删除packages.json中的引用
meteor add sendwithus
使用SendWithUs变量
也许这可以改进?