代码之家  ›  专栏  ›  技术社区  ›  rituparna

节点.jsfirebase返回则不是函数

  •  0
  • rituparna  · 技术社区  · 8 年前

    TypeError: request(...).then is not a function
    at Object.<anonymous> (E:\FirebaseNotif\group.js:26:4)
    at Module._compile (internal/modules/cjs/loader.js:678:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
    at Module.load (internal/modules/cjs/loader.js:589:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
    at Function.Module._load (internal/modules/cjs/loader.js:520:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:719:10)
    at startup (internal/bootstrap/node.js:228:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:576:3)
    

    我的要求是。。

     request(options, function (error, response, body) {
     console.log(body);
     key = body.notification_key;
    
     return key;
    
     }).then(result =>{
     console.log('my key is : ' + key); 
     });
    
    0 回复  |  直到 8 年前