Siri implementation in IONIC- Cli 5.4.13 Native - ios

When i install Cordova Plugin cli command some exception get error display in below
Using "requireCordovaModule" to load non-cordova module "glob" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
[ERROR] An error occurred while running subprocess cordova.
How to implementation IONIC Native -Siri

This error sometimes implies that the plugin is not compatible with your project's cordova version. Try downgrading to Cordova 8, I think ionic 5 application comes loaded with Cordova 9. Add cordova dev dependancy as
npm install cordova#8.0.0 --save-dev

Related

Failing to build an iOS app built using Cordova / Ionic using Azure DevOps

Trying to build an iOS app built using Ionic / Cordova on Azure DevOps
Getting this error:
Using cordova-fetch for cordova-ios#^5.0.0
Failed to fetch platform cordova-ios#^5.0.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: Cannot find module 'UNMET/package.json' from '/Users/vsts/agent/2.148.2/work/1/s'
[ERROR] An error occurred while running subprocess cordova.
I am using a simple setup using the following steps:
Agent: Hosted macOs
npm install
Ionic Command [ionic version: 4.12.0; Cordova Version: default]
Publish Build Artifacts
We had the same problem, and the solution was to make sure all NPM dependencies were met.
Check the logs for the npm install step and see if there are any unmet dependencies there and add/update missing depedencies in your package.json file.

Cordova can't add plugin: Error: Cannot find module 'unorm'

I'm trying to add a plugin to my cordova app, but I get an error saying "The platform "ios" does not appear to be a valid cordova platform. It is missing API.js. ios not supported."
node --version
v9.2.0
cordova --version
8.0.0
Here is the command I'm running
cordova plugin add cordova-plugin-appinfo
And the complete output:
Installing "cordova-plugin-appinfo" for ios
Unable to load PlatformApi from platform. Error: Cannot find module 'unorm'
Failed to install 'cordova-plugin-appinfo': 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 (/Users/james/.nvm/versions/node/v9.2.0/lib/node_modules/cordova/node_modules/cordova-common/src/events.js:71:17)
at Object.getPlatformApiFunction (/Users/james/.nvm/versions/node/v9.2.0/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/util.js:499:20)
at Object.getPlatformApi (/Users/james/.nvm/versions/node/v9.2.0/lib/node_modules/cordova/node_modules/cordova-lib/src/platforms/platforms.js:55:25)
at handleInstall (/Users/james/.nvm/versions/node/v9.2.0/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:593:29)
at /Users/james/.nvm/versions/node/v9.2.0/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:357:28
at _fulfilled (/Users/james/.nvm/versions/node/v9.2.0/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/Users/james/.nvm/versions/node/v9.2.0/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/Users/james/.nvm/versions/node/v9.2.0/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:749:13)
at /Users/james/.nvm/versions/node/v9.2.0/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:509:49
(node:35697) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Unhandled error. (The platform "ios" does not appear to be a valid cordova platform. It is missing API.js. ios not supported.)
(node:35697) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I'm certain this is a valid Cordova project and the iOS platform seems to work fine (I can build and run on an iPhone).
I ran into same error after attempting to update ios platform.
It turns out there was some corruption in the node_modules download cache.
I was able resolve this by trying a second time:
cordova platform rm ios
cordova platform add ios#latest
I just encountered this and the currently accepted answer (remove then add the ios platform) didn't work for me. Instead it looks like the problem is with the nodejs version. Downgrading from node 16 to node 12 made it work. Got this from this answer. I use nvm so for me it was easy as:
nvm install 12 --lts
nvm use 12

Cordova 8 + iOS 4.5.4 = cannot find module "../cordova/platform_metadata"

Since the latest update to v8 of Cordova, I cannot build anything on Mac.
I always get
(node 626) UnhandledPromiseRejectionWarning: Error: Cannot find module '../cordova/platform_metadata'
I tried what was suggested in this post but I get the same error.
I then did a verbose and it seems like the plugin required to build for ios is not working well
Executing script found in plugin cordova-plugin-swift-support for hook "after_prepare": plugins/cordova-plugin-swift-support/src/add-swift-support.js
Resolving module name for cordova-lib/src/cordova/platform_metadata => ../cordova/platform_metadata
(node:599) UnhandledPromiseRejectionWarning: Unhandled promise rejection
(rejection id: 1): Error: Cannot find module '../cordova/platform_metadata'
(node:599) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.
This was a bug in cordova-plugin-add-swift-support, just update it to latest version (1.7.1)
cordova plugin rm cordova-plugin-add-swift-support
cordova plugin add cordova-plugin-add-swift-support
you need to downgrade cordova 7.1.0 until this issue is fixed. Do this:
npm uninstall -g cordova
npm install -g cordova#7.1.0
cordova platform remove ios
cordova platform add ios
If your running an ionic project that requires the swift plugin you'll need to add the --force flag:
ionic cordova plugin rm cordova-plugin-add-swift-support --force
Then run:
ionic cordova plugin add cordova-plugin-add-swift-support
That just happened to me (using Ionic). In Ionic, the issue comes from a plugin or node_module that is still using cordova/platform_metadata, which is deprecated.
If you are using Linux, in your project directory, try this in the command shell:
grep -iRn 'platform_metadata'
In my case, it was the plugin cordova-plugin-add-swift-support that was still using that, and I wasn't even using that plugin my project, so I deleted it manually. Problem solved. The issue seems to arise when a plugin is calling a module that no longer exists, so you have to either remove that plugin or update it.
With Ionic 3 and Cordova 8.0.0 project.
Here are steps
ionic cordova platform remove ios
ionic cordova plugin rm cordova-plugin-add-swift-support
ionic cordova plugin add cordova-plugin-add-swift-support
ionic cordova platform add ios
I have faced same problem, then upgraded Cordova to 7.1.0 work for me
From my ionic project I did (bash):
grep -r 'platform_metadata' .
and found I had a plugin called cordova-plugin-swift-support was the culprit. I removed it and then added cordova-plugin-add-swift-support back in, and everything worked fine with cordova 8.0.0

The platform "ios" does not appear to be a valid cordova platform

I'm running under cordova#7.1.0, cordova-ios#4.5.2.
Installed platforms: ios 4.5.2.
I run npm install, bower install then cordova prepare ios and i get the following error:
Unable to load PlatformApi from platform. Error: Cannot find module 'unorm'
Error: Unhandled "error" event. (The platform "ios" does not appear to be a valid cordova platform. It is missing API.js. ios not supported.)
The solution is to cordova platform rm ios and cordova platform add ios. But i have to do this each time i checkout my project from git ...
Do you have any suggestion to solve this issue?
Many thanks !
You should not put the platforms (and plugins) folder into source-control. Reinstalling the platform after a fresh checkout is the expected behaviour.
The files in the platforms folder are created dynamically which is why they should not be in source control.

Ionic Platform Add IOS

when I try to add platform ios to my current ionic project the following problem is occurred to me:
Installing "cordova-plugin-whitelist" for ios
Plugin doesn't support this project's cordova-ios version. cordova-ios: 3.9.1, failed version requirement: >=4.0.0-dev
Skipping 'cordova-plugin-whitelist' for ios
How to solve the problem above? What should I do for it?
When I was reading the Ionic docs, I saw a section about Cordova which is called "Cordova Updates". So...when you get an error, a good practice is to search at the official documentation - it might be helpful.
Cordova Updates
$ sudo npm update -g cordova
In your case:
$ cordova platform update ios
Hope it helps.
$ cordova plugin rm cordova-plugin-whitelist
$ cordova plugin add cordova-plugin-whitelist#1.0.0

Resources