[英]Meteor “cannot find module 'braintree'”
我正在嘗試將Braintree付款與我的網站集成,但是Meteor不斷出現以下錯誤:
Error: Cannot find module 'Braintree'
我使用meteor add ulexus:braintree
和meteor add hiukim:braintree-helper
meteor add ulexus:braintree
到了項目中。
我跟隨着這個嘗試來使我的項目正常工作。 這是我的代碼:
// 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
出現錯誤cannot call method baseUrl on undefined
。
我真的很感謝您的幫助。 注意:我以前從未使用過Braintree,直到最近才開始使用Meteor。
謝謝!
只需添加braintree與
npm install braintree
並與
var braintree = require("braintree");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.