【发布时间】:2015-03-10 22:55:03
【问题描述】:
我正在尝试将 Braintree 付款与我的网站集成,但 Meteor 不断给出以下错误:
Error: Cannot find module 'Braintree'
我使用 meteor add ulexus:braintree 和 meteor add hiukim:braintree-helper 将流星添加到我的项目中。
我跟随this 尝试让我的项目正常运行。这是我的代码:
// inside Meteor.startup
Braintree = Npm.require('braintree');
var config = Braintree.connect({
environment: Braintree.Environment.Sandbox,
merchantId: "my merchant id",
privateKey: "my private key",
publicKey: "my public key"
});
BraintreeHelper.getInstance().connect(config);
我也尝试使用sudo npm install braintree 安装 Braintree,但这也不起作用。如果我尝试不使用Braintree = ...,则会收到错误cannot call method baseUrl on undefined。
我非常感谢任何帮助。注意:我以前从未使用过 Braintree,最近才开始使用 Meteor。
谢谢!
【问题讨论】:
-
我也无法让它工作。不过我知道至少有一位 Braintree 开发人员使用 Meteor atm,所以希望他们能提供帮助。
-
好吧,我终于让它工作了。删除
Braintree = Npm.require('braintree')和BraintreeHelper.getInstance().connect(config)行(考虑到 Atmospherejs 自述文件据说有这些行有点奇怪),然后更新packages.json文件以包含"hokum:braintree-helper" : "1.0.0" -
@Trent 我在 Braintree 工作。如果这解决了您的问题,请将其作为答案发布,以便我可以投票给它,其他人可以更轻松地找到它。很高兴你能弄明白!
-
这里有同样的错误。工作得很好。然后我更新到 Meteor 1.0.4 现在出现上述错误。
标签: javascript node.js meteor braintree