在 Meteor 中:如何使用应该从存储库中提取的 npm 库?
In Meteor: How to use a npm library that should be pulled from a repository?
在我的 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'.
根据我发布到enter link description here时对这个问题的回答,唯一的解决办法是创建一个假的流星包来包装新的节点库。
Npm.depends({sendwithus: "https://github.com/whalepath/sendwithusnodejs/commit/41b0d177f6eabf02de2daec9bb2b36daebbfbef4"});
要扩展此答案:
仅使用 npm 库的分支需要:
packages/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');
});
正在删除 packages.json
中的引用
meteor add sendwithus
使用 SendWithUs 变量
也许这可以改进?
在我的 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'.
根据我发布到enter link description here时对这个问题的回答,唯一的解决办法是创建一个假的流星包来包装新的节点库。
Npm.depends({sendwithus: "https://github.com/whalepath/sendwithusnodejs/commit/41b0d177f6eabf02de2daec9bb2b36daebbfbef4"});
要扩展此答案: 仅使用 npm 库的分支需要:
packages/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');
});
正在删除 packages.json
中的引用
meteor add sendwithus
使用 SendWithUs 变量
也许这可以改进?