TypeError:无法读取未定义的属性'on'

时间:2016-06-01 11:39:48

标签: angularjs-directive ionic-framework

此错误是在执行离子推送通知程序时,此处“on”用于接收通知但由于跟随错误我无法继续

C:\Users\orcilia49\Desktop\AWpush_v1.1>ionic push --google-api-key AIzaSyCftJZvkhujq8IK4ayTbW9Me-Q9qb78n-c
C:\Users\orcilia49\AppData\Roaming\npm\node_modules\ionic\lib\ionic\push.js:140
      response.on("data", function(data) {
              ^

TypeError: Cannot read property 'on' of undefined
    at ClientRequest.<anonymous> (C:\Users\orcilia49\AppData\Roaming\npm\node_modules\ionic\lib\ionic\push.js:140:15)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at TLSSocket.socketErrorListener (_http_client.js:306:9)
    at emitOne (events.js:96:13)
    at TLSSocket.emit (events.js:188:7)
    at connectErrorNT (net.js:1015:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

C:\Users\orcilia49\Desktop\AWpush_v1.1>

event.js

    angular.module('starter', ['ionic']).run(function($ionicPlatform) {
  var push = new Ionic.Push({
    "debug": true
  });
  push.register(function(token) {
    console.log("My Device token:", token.token);
    push.saveToken(token);
  });
  $ionicPlatform.ready(function() {
    if (window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      cordova.plugins.Keyboard.disableScroll(true);
    }
    if (window.StatusBar) {
      StatusBar.styleDefault();
    }
  });
})

0 个答案:

没有答案