Impossible to update plugins and not a valid cordova platform?

I have a problem trying to update any plugin in cordova using mac os terminal. When I try to run the cordova plugin add xxxxxxx command, it tells me that both of my android / ios are not valid cord platforms.

My version is Node v9.2.0, the NPM version is 5.5.1, and the Cordoba version is 7.1.0. I don’t understand how to do this. Can someone give an idea?

  ➜ steve git:(master) βœ— cordova plugin add https://github.com/danwilson/google-analytics-plugin.git Installing "cordova-plugin-google-analytics" for ios Unable to load PlatformApi from platform. Error: Cannot find module '/Users/rsteve/Desktop/steve/platforms/ios/cordova/Api.js' Failed to install 'cordova-plugin-google-analytics': Error [ERR_UNHANDLED_ERROR]: Unhandled error. (The platform "ios" does not appear to be a valid cordova platform. It is missing API.js. ios not supported.) at EventEmitter.emit (events.js:140:19) at EventEmitter.module.exports.emit (/usr/local/lib/node_modules/cordova/node_modules/cordova-common/src/events.js:71:17) at Object.getPlatformApiFunction (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/util.js:500:20) at Object.getPlatformApi (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/platforms/platforms.js:55:25) at handleInstall (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:593:29) at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:357:28 at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54) at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30) at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13) at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:509:49 

Error: Unhandled error. (The "ios" platform does not seem to be a valid cordova platform. Missing API.js. ios is not supported.)

enter image description here

+5
source share
2 answers

In my experience, everything solves almost all problems with plugins / cordova platform:

 cordova plugins --save cordova platforms --save rm -rf platforms rm -rf plugins cordova prepare 

It does this:

  • saving plugin configuration
  • saving configuration configuration
  • delete folder folder
  • delete plugins folder
  • reinstalling all platforms and plugins
+1
source

It seems your version of node is not supported with cordova / ionic

Decision:

  • Reduce node: Reduce the version of node (use the recommended version of the node js form) or try with node 6.xx

  • Install Git . Have you installed git on your computer? Cordova needs Git to clone plugins from the server

  • Permissions: Make sure your folder has read / write permissions; or try with administrator privileges

  • Install directly from Git: you can install plugins directly from Git using git clone plugin-url and then install cordova plugin add -d /plugin-path/
0
source

Source: https://habr.com/ru/post/1273724/


All Articles