WordPress LMS for Web and mobile Forums WPLMS Student App Installing necessary packages Lastest WPLMS App >> TS error with "ionic serve" in /services/imageCache.ts

Lastest WPLMS App >> TS error with "ionic serve" in /services/imageCache.ts

Back to course
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #13678

    Peter O.
    Participant

    I started with a clean new ionic project and installed your latest code (codecanyon20632362wplmsAppV2.2_18jly11). After installing the necessary packages based on your tutorial: https://wplms.io/course/getting-started-with-wplms-mobile-app/installing-app-packages/

    I have this TS error: https://www.screencast.com/t/RX0REtUt3Vi

    Please advise how to resolve this?

    Thanks.

    — copy of error text below —

    Typescript Error

    Property ‘applicationStorageDirectory’ does not exist on type ‘File’.

    D:/-/DevMobi/wplms/q3/src/services/imageCache.ts

    private normalizeURlWKWview(url: string) {

    const urlIos = ${normalizeURL(this.file.applicationStorageDirectory)}Library/files/${normalizeURL(url)};

    return urlIos.replace(‘/localhost/persistent’, ”);

    Ionic Framework: 3.9.2

    Ionic App Scripts: 3.1.10

    Angular Core: 5.2.11

    Angular Compiler CLI: 5.2.11

    Node: 8.11.2

    OS Platform: Windows 10

    Navigator Platform: Win32

    User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36

     

     

    #13679

    Peter O.
    Participant

    Hi Alex,

    Adding to my support request, here some more info.  I get the following error when I attempt to do:

    ionic cordova build android

    with a terminated build, and the following error:

    … Installing “cordova-plugin-ionic-keyboard” for android

    Adding cordova-plugin-ionic-keyboard to package.json

    Saved plugin info for “cordova-plugin-ionic-keyboard” to config.xml

    –save flag or autosave detected

    Saving [email protected]~7.0.0 into config.xml file …

    Running app-scripts build: –platform android –target cordova

    [19:14:03]  build dev started …

    [19:14:03]  clean started …

    [19:14:03]  clean finished in 6 ms

    [19:14:03]  copy started …

    [19:14:04]  deeplinks started …

    [19:14:04]  deeplinks finished in 510 ms

    [19:14:04]  transpile started …

    [19:14:12]  typescript: D:/-/DevMobi/wplms/q3/src/services/imageCache.ts, line: 75

    Property ‘applicationStorageDirectory’ does not exist on type ‘File’.

    L74:  private normalizeURlWKWview(url: string) {

    L75:    const urlIos = ${normalizeURL(this.file.applicationStorageDirectory)}Library/files/${normalizeURL(url)};

    L76:    return urlIos.replace(‘/localhost/persistent’, ”);

    Error: Failed to transpile program

    at new BuildError (D:\-\DevMobi\wplms\q3\node_modules\@ionic\app-scripts\dist\util\errors.js:16:28)

    at D:\-\DevMobi\wplms\q3\node_modules\@ionic\app-scripts\dist\transpile.js:159:20

    at new Promise (<anonymous>)

    at transpileWorker (D:\-\DevMobi\wplms\q3\node_modules\@ionic\app-scripts\dist\transpile.js:107:12)

    at Object.transpile (D:\-\DevMobi\wplms\q3\node_modules\@ionic\app-scripts\dist\transpile.js:64:12)

    at D:\-\DevMobi\wplms\q3\node_modules\@ionic\app-scripts\dist\build.js:109:82

    at <anonymous>

    [19:14:12]  copy finished in 8.51 s

    Thank you for your assistance. I hope we can get this fixed quickly. 

    #13682

    Alex
    Keymaster

    Please try running the following commands in your ionic project folder:

     

    cordova plugin rm cordova-plugin-file

    cordova plugin add [email protected]

     

    npm install @ionic-native/[email protected]

     

     

    then run :

     

    cordova clean

    cordova plugin save

    cordova prepare

     

    #13686

    Peter O.
    Participant

    Hi Alex, 

    I followed your instructions. After running: 

    cordova plugin rm cordova-plugin-file

    I got this error message:

    (node:9328) UnhandledPromiseRejectionWarning: CordovaError: The plugin ‘cordova-plugin-file’ is required by (cordova-plugin-file-transfer), skipping uninstallation. (try –force if trying to update)

    So, I then ran this:

    cordova plugin rm cordova-plugin-file –force

    cordova plugin add [email protected]

    npm install @ionic-native/[email protected]

    cordova clean

    cordova plugin save

    cordova prepare

    Next some progress as I was able to successfully execute: 

    ionic serve

    The “ionic serve” completed without error. I was able to view the app in my Chrome browser.  So, then I ran:

    ionic cordova build android

    This  build failed with the following messages:

    [23:55:26]  lint finished in 10.81 s

    :app:preDebugBuild FAILED

    FAILURE: Build failed with an exception.

    * What went wrong:

    Could not resolve all files for configuration ‘:app:debugCompileClasspath’.

    > Could not find play-services-auth-base-license.aar (com.google.android.gms:play-services-auth-base-license:11.8.0).

    Searched in the following locations:

    https://jcenter.bintray.com/com/google/android/gms/play-services-auth-base-license/11.8.0/play-services-auth-base-license-11.8.0.aar

    11 actionable tasks: 11 executed

    * Try:

    Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.

    * Get more help at https://help.gradle.org

    BUILD FAILED in 12s

    (node:4576) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:

    FAILURE: Build failed with an exception.

    * What went wrong:

    Could not resolve all files for configuration ‘:app:debugCompileClasspath’.

    > Could not find play-services-auth-base-license.aar (com.google.android.gms:play-services-auth-base-license:11.8.0).

    Searched in the following locations:

    https://jcenter.bintray.com/com/google/android/gms/play-services-auth-base-license/11.8.0/play-services-auth-base-license-11.8.0.aar

    * Try:

    Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.

    * Get more help at https://help.gradle.org

    BUILD FAILED in 12s

    at ChildProcess.whenDone (D:\-\DevMobi\wplms\q3\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)

    at emitTwo (events.js:126:13)

    at ChildProcess.emit (events.js:214:7)

    at maybeClose (internal/child_process.js:925:16)

    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

    (node:4576) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

    (node:4576) [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.

    Hope you can provide further help on this. Thank you.

     

     

     

    #13727

    Alex
    Keymaster

    Well that is build.gradle error .

    Please goto your ionic project folder -> platforms -> android and take backup of your build.gradle file and replace it with this given build.gradle file and then try building your ionic app /.

     

    https://bit.ly/2LczqTP

     

    this is gradle error and a very common one please do some search on it on your own .It will be resolved .

     

     

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.