2 Replies Latest reply on Oct 28, 2017 9:27 AM by jf96091620

    Phonegap plugin add fails because "browser" platform is not valid

    jf96091620 Level 1

      Hello guys,

       

      I've been working with PhoneGap for a week, and I'm not able to install new plugins with the command: $ phonegap plugin add

       

      For example, if I try to install cordova.plugins.diagnostic, this is the error I get (it occurs the same for the rest of the plugins):

       

      $ phonegap plugin add cordova.plugins.diagnostic
      Installing "cordova.plugins.diagnostic" for browser
      
      
      Unable to load PlatformApi from platform. Error: Cannot find module '/Users/george/Documents/phonegap/TryPushNotifications/platforms/browser/cordova/Api.js'
      
      
      Failed to install 'cordova.plugins.diagnostic': Error: Unhandled "error" event. (The platform "browser" does not appear to be a valid cordova platform. It is missing API.js. browser not supported.)
          at EventEmitter.emit (events.js:185:19)
          at EventEmitter.module.exports.emit (/usr/local/lib/node_modules/phonegap/node_modules/cordova-common/src/events.js:71:17)
          at Object.getPlatformApiFunction (/usr/local/lib/node_modules/phonegap/node_modules/cordova-lib/src/cordova/util.js:500:20)
          at Object.getPlatformApi (/usr/local/lib/node_modules/phonegap/node_modules/cordova-lib/src/platforms/platforms.js:55:25)
          at handleInstall (/usr/local/lib/node_modules/phonegap/node_modules/cordova-lib/src/plugman/install.js:593:29)
          at /usr/local/lib/node_modules/phonegap/node_modules/cordova-lib/src/plugman/install.js:357:28
          at _fulfilled (/usr/local/lib/node_modules/phonegap/node_modules/q/q.js:787:54)
          at self.promiseDispatch.done (/usr/local/lib/node_modules/phonegap/node_modules/q/q.js:816:30)
          at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/phonegap/node_modules/q/q.js:749:13)
          at /usr/local/lib/node_modules/phonegap/node_modules/q/q.js:509:49
      
      
      Error: Unhandled "error" event. (The platform "browser" does not appear to be a valid cordova platform. It is missing API.js. browser not supported.)
      

       

       

       

      How can I solve this? I didn't find a solution on Google and I'd really appreciate if you can help me.

      Thank you.

       

      ----------

       

      Information of my current system:

       

      OS => macOS Sierra 10.12.6

      phonegap -v => 7.1.1

      npm -v => 5.3.0

      cordova -v => 7.1.0