ionic use video.js throws error - ionic-framework

I try to use video.js as my video player, but reaches error:
Uncaught (in promise): Error: Cannot find module "safe-json-parse/tuple" Error: Cannot find module "safe-json-parse/tuple"
Steps I did:
npm install -S video.js
import videojs from 'video.js';
write code in palyer.ts => videojs('my-player', { controls: true});
above error appears when player page is hit.
Anybody has any idea? Or what other 3rd party html5 video player can be easily plugged in?
environment details:
ionic info
global packages:
#ionic/cli-utils : 1.4.0
Cordova CLI : 7.0.1
Ionic CLI : 3.4.0
local packages:
#ionic/app-scripts : 1.3.7
#ionic/cli-plugin-cordova : 1.4.0
#ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 3.3.0
System:
Node : v6.10.3
OS : Linux 4.10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 3.10.10

I did the same thing, I had a safe-json-parse module so thought I was fine, but after doing:
npm install -s safe-json-parse
new files were added and the error was gone.

I downloaded the videojs js and css files to assets/ folder and references them in index.html.
By this way videojs works, though not as elegant as with npm package

Related

Ngx-translate build prod issues in IONIC 4

I'm using ngx translate for translation in my ionic 4 project. But when i try to run:
ionic cordova build android -prod
Throws this error:
ERROR in Illegal State: referring to a type without a variable {"filePath":"C:/XXX/XXX/XXX/XXX/PROJECTNAME/node_modules/#ngx-translate/core/ngx-translate-core.d.ts","name":"TranslatePipe","members":[]}
[ERROR] An error occurred while running subprocess ng
My ionic info:
Ionic:
Ionic CLI : 5.2.7 (C:\Users\USER\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : #ionic/angular 4.9.0
#angular-devkit/build-angular : 0.801.3
#angular-devkit/schematics : 8.1.3
#angular/cli : 8.1.3
#ionic/angular-toolkit : 2.0.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib#9.0.1)
Cordova Platforms : not available
Cordova Plugins : not available
Utility:
cordova-res : 0.6.0
native-run : 0.2.8
System:
Android SDK Tools : 26.1.1 (C:\Users\USER\AppData\Local\Android\Sdk)
NodeJS : v12.5.0 (C:\Program Files\nodejs\node.exe)
npm : 6.9.0
OS : Windows 10
Please help!!!
The accepted answer is a solution to avoid the problem, but when a production build is needed, things are looking bad.
Workaround to achieve this is to access your tsconfig.json and disable fullTemplateTypeCheck to false. Include it, if you can not find it.
"angularCompilerOptions": {
"fullTemplateTypeCheck": false,
...
},
This error actually means that a reference failure is present among your components and modules. That could be a dupliate reference in a module or and submodule or any the like. This would result in ommiting to make a needed variable available. In your case that is the variable of ngx-translate (which your either call in the template or component file).
Setting the fullTemplateTypeCheck to false will help you to get the insights (including code line) about your false module references. But you must fix it yourself. Usually an easy fix. If you are uncertain, run again ng build --prod --verbose to see get more indications about the false relations.
you do not need to write -prod because it converts the file into minified version so device to hard to read. u just need run without -prod
ionic cordova build android
if you want a release APK just run
ionic cordova build android --release
after that, u do not face any issue.

Ionic 3 Native Plugin Social Sharing Error: Plugin not installed

I’m using an Ionic 3 app, trying to get social sharing working.
I followed the steps to install the Ionic Native Social Sharing plugin from: https://ionicframework.com/docs/v3/native/social-sharing/
Ran:
$ ionic cordova plugin add cordova-plugin-x-socialsharing
$ npm install --save #ionic-native/social-sharing#4
Imported the plugin (version 4.x.x) via my app module and added SocialSharing to the providers array.
Imported the plugin via my app.component using:
import { SocialSharing } from '#ionic-native/social-sharing';
Added to the constructor:
private socialSharing: SocialSharing
This share function, also in app.component is triggered via a button in the html (side menu):
async share() {
try {
// Pop the native social sharing sheet, allowing the user to choose how to share the app.
await this.socialSharing.share(this.shareMessage, this.shareSubject, this.shareFile, this.getShareUrl());
this.toast.show('Thanks for sharing!', 3000);
}
catch(err) {
console.error(err);
alert(err);
}
}
I’m using platforms: ios, android and browser.
When I call the method from a build on a real device I get the error:
"Plugin is not installed"
Tried:
Checking logs for installation errors. None seen.
Reinstalled plugin.
Checked plugin present using $ionic cordova plugin list. cordova-plugin-x-socialsharing 5.4.7 “SocialSharing” is present.
Removed and added all platforms again.
Wrapped the share method inside a platform.ready().
Nothing seems to be working. I cannot get the app to recognise the plugin is installed!
PLEASE HELP! :slight_smile: What can I try next?
Thanks
$ionic info:
Ionic:
Ionic CLI : 5.2.3 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.5
#ionic/app-scripts : 3.2.2
Cordova:
Cordova CLI : 9.0.0 (cordova-lib#9.0.1)
Cordova Platforms : android 8.0.0, browser 6.0.0, ios 5.0.1
Cordova Plugins : cordova-plugin-ionic 5.4.0, cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.5.1, (and 13 other plugins)
Utility:
cordova-res : 0.4.0 (update available: 0.6.0)
native-run : not installed
System:
ios-deploy : 1.9.4
ios-sim : 8.0.2
NodeJS : v11.2.0 (/usr/local/Cellar/node/11.2.0/bin/node)
npm : 6.9.2
OS : macOS Mojave
Xcode : Xcode 10.2 Build version 10E125
So according to your information your current installed plugin is version 5.4.7, to make plugins work with Ionic 3 you need to ensure you have installed 4.* version of the plugin.
Seems like you are using the right command for the install (adding #4 after the plugin install command).
Can you try uninstall the plugin and then attempt to reinstall and note which version its installing. You may have to try and install 4.* version:
npm install --save #ionic-native/social-sharing#4.12.0
I got an issue with cordova-plugin-x-socialsharing in Ionic3 and main issue was couldn't install cordova-plugin-x-socialsharing plugin properly(error: can't find plugin.xml for es6-promise-plugin).
Steps to fix:
Installed es6-promise-plugin : ionic cordova plugin add https://github.com/vstirbu/PromisesPlugin
Installed cordova-plugin-x-socialsharing : ionic cordova plugin add cordova-plugin-x-socialsharing
npm install --save #ionic-native/social-sharing#4

I need to compile an old project (IONIC 2)

I have a project on ionic 2, which I have not touched for 3 years, but the client is asking me to change a simple link. And I can not build the application. What should I take into account to recover this project?
I do not want to migrate to ionic 3 or ionic 4, I just want to change the webservices link and that the application continues in ionic 2.
cli packages: (/usr/local/lib/node_modules)
#ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : not installed
local packages:
#ionic/app-scripts : 1.1.4
Cordova Platforms : none
Ionic Framework : ionic-angular 2.2.0
System:
Android SDK Tools : 26.1.1
ios-deploy : 1.9.2
Node : v8.9.3
npm : 5.5.1
OS : macOS
Xcode : Xcode 10.1 Build version 10B61
Is it possible to build this old project on ionic 2 on my computer?
EDIT:
when sudo ionic cordova platform add android i get:
`(node:41668) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: Failed to fetch platform cordova-android#7.0.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm WARN #ionic/app-scripts#1.1.4 requires a peer of #angular/tsc-wrapped#* but none is installed. You must install peer dependencies yourself.
npm WARN #ionic/cli-plugin-ionic-angular#1.3.1 requires a peer of #ionic/app-scripts#^1.3.7 but none is installed. You must install peer dependencies yourself.
npm ERR! Cannot read property '0' of undefined`
u should install Cordova first, like this,use # plus version number as needed
npm install -g cordova

Getting "Sorry! The configured backend (pro) does not know about ionic upload" When trying to upload the Ionic App

I'm trying to upload the App I built to my Ionic Pro account.
I've linked my account and added the SSH keys but after running ionic upload I'm getting this error
[ERROR] Sorry! The configured backend (pro) does not know about ionic upload.
This is My Ionic Info
cli packages: (/home/jos/Desktop/helloapp/node_modules)
#ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2
global packages:
Cordova CLI : 7.0.1
Gulp CLI : not installed globally
local packages:
Cordova Platforms : android 6.2.3 browser 4.1.0
Ionic Framework : ionic1 1.3.1
System:
Android SDK Tools : 26.0.2
Node : v6.11.0
npm : 3.10.10
OS : Linux 3.13
ionic upload doesn't work with backend pro, you have to create an app
on https://dashboard.ionicjs.com/apps and there will be a setup guide :)

I am getting Runtime Error when I update ionic2 project to ionic3 ?

Runtime Error
Module build failed: Error: ENOENT: no such file or directory, open '/Users/.../src/constants/Strings.js.map' at Error (native)
typescript": "2.3.4"
Ionic info
global packages:
#ionic/cli-utils : 1.4.0
Cordova CLI : 7.0.1
Ionic CLI : 3.4.0
local packages:
#ionic/app-scripts : 1.3.7
#ionic/cli-plugin-cordova : 1.4.0
#ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.4.2
System:
Node : v6.10.3
OS : macOS Sierra
Xcode : Xcode 8.3.2 Build version 8E2002
ios-deploy : 1.9.1
ios-sim : 5.0.13
npm : 5.0.3
reading this post on the official ionic blog it seems like it could be some import that are unmatched because capital letters.
Give it a try, hope this helps you to solve your problem.