错误:找不到模块"paypal-ipn" [英] Error: Cannot find module 'paypal-ipn'

查看:114
本文介绍了错误:找不到模块"paypal-ipn"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正在使用 Paypal教程中的论坛进行测试IPN侦听器,当我单击提交"时,将打开一个新选项卡,并显示:

Am using the forum in Paypal tutorial to test the IPN listener, when i click on submit a new tab is opened and it says:

    Error: Cannot find module 'paypal-ipn' at Function.Module._resolveFilename (module.js:338:15) 
    at Function.Module._load (module.js:280:25) 
at Module.require (module.js:364:17) 
at require (module.js:380:17) at Object.Npm.require (/Users/mazinalmaskari/Desktop/code/.meteor/local/build/programs/server/boot.js:150:18) 
at Object.Meteor.npmRequire (packages/npm-container/index.js:2:1) at [object Object].route.action (server/routing.js:6:30) at boundNext (packages/iron_middleware-stack/lib/middleware_stack.js:251:1) at runWithEnvironment (packages/meteor/dynamics_nodejs.js:110:1)

我不确定问题出在哪里,当我单击提交时,我在ngrok中得到了500 Internal Server Error.

Am not sure where the problem is exactly, I get 500 Internal Server Error in the ngrok when i click submit.

这是我位于服务器中的IPN侦听器

this is my IPN listener located in the server

Router.map(function () {
    this.route('ipn', {
        path: '/ipn',
        where: 'server',
        action: function() {
            var ipn = Meteor.npmRequire("paypal-ipn");
            var wrappedVerify = Async.wrap(ipn, "verify");

            var request = this.request;
            var verified;

            if (request.method !== 'POST') {

              this.next();

            } else {

              try {
                verified = wrappedVerify(request.body, {"allow_sandbox" : true});
              } catch (error) {
                //do something with error
              }

              if (verified === "VERIFIED") {
                var payment = request.body;
                //do something with payment
                Router.go('/upload');
              }

              this.next();
            }

        }
     });
  });

这是正在使用的表单(来自Paypal教程):

This is the form am using (from Paypal tutorial):

<form target="_new" method="post" action="https://ba13954b.ngrok.io/ipn">
          <input type="hidden" name="SomePayPalVar" value="SomeValue1"/>
          <input type="hidden" name="SomeOtherPPVar" value="SomeValue2"/>
 <input type="submit"/>

您知道什么可能导致此问题吗?

Any idea what might be causing this problem?

推荐答案

按照错误消息指示查看模块.但... 尝试这样:

Review the module as the error message indicate. But... Try like this:

var ipn = Meteor.npmRequire('paypal-ipn');

基于: https://github.com/meteorhacks/npm

这篇关于错误:找不到模块"paypal-ipn"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆