Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Setting up your development environment for the Moodle App: Difference between revisions

From MoodleDocs
(Update npm commands)
Line 7: Line 7:


The structure of this page is
The structure of this page is
* the first part, up to the point where you get the 'ionic serve' command to work is what you need to be able to do development on the app and test it in a browser.
* the first part, up to the point where you get the <tt>npm start</tt> command to work is what you need to be able to do development on the app and test it in a browser.
* the second part is about how to build a version of the app that can be run on a device.
* the second part is about how to build a version of the app that can be run on a device.
* then at the end is a list of troubleshooting advice. If you encouter a problem that is not already listed, please consider adding it.
* then at the end is a list of troubleshooting advice. If you encounter a problem that is not already listed, please consider adding it.


The majority of your development will be done using a browser. You will probably on begin to use an emulator once you need to simulate a real mobile device.
The majority of your development will be done using a browser. You will probably only begin to use an emulator once you need to simulate a real mobile device.


If you are just [[Mobile support for plugins|adding mobile support to plugins]], remember that most of your development can be done using the online pre-built version at https://mobileapp.moodledemo.net/ (with Chrome or Chromium). However, if you want to be able to to write [[Acceptance_testing_for_the_mobile_app|automated acceptance tests for the app]] then you need to follow this page at least as far as getting the ionic serve command to work on this page.
If you are just [[Mobile support for plugins|adding mobile support to plugins]], remember that most of your development can be done using the online pre-built version at https://mobileapp.moodledemo.net/ (with Chrome or Chromium). However, if you want to be able to to write [[Acceptance_testing_for_the_mobile_app|automated acceptance tests for the app]] then you need to follow this page at least as far as getting the <tt>npm start</tt> command to work on this page.


== Requirements ==
== Requirements ==


Windows tip: ingore any use of the sudo command below. Just use the command without it. Most things work that way, and if they don't try in a Powershell window that you have opened with 'Run as administrator ...'.
Windows tip: ingore any use of the sudo command below. Just use the command without it. Most things work that way. And if they don't, try in a Powershell window that you have opened with 'Run as administrator ...'.


===Install a browser for development===
===Install a browser for development===
Line 30: Line 30:
===Install Node.js===
===Install Node.js===


On Linux we recommend you use [https://github.com/creationix/nvm nvm] - this lets you switch Node versions, and makes the install a bit easier than the official installation route.
On Linux we recommend you use [https://github.com/creationix/nvm nvm] - this lets you switch Node versions, and makes the installation a bit easier than the official installation route.


  nvm install node
  nvm install node
  nvm use 11.12.0 # Or whatever number nvm install reported.
  nvm use 11 # This is important, npm commands will not work in other versions
 
(Exact version is probably not critical. Moodle HQ devs report using both 8.12.x and 11.12.0 as of 2019-03-25.)


On Windows we recommend you use https://github.com/coreybutler/nvm-windows. Same nvm commands as for Linux.
On Windows we recommend you use https://github.com/coreybutler/nvm-windows. Same nvm commands as for Linux.


On Mac users we recommend to install NodeJS via Macports.
On Mac we recommend installing NodeJS via Macports.
 
(It may seem simpler and easier to install directly from http://nodejs.org, but actually it seems to me more tricky to get that to work. If you have previously installed Node directly, and want to switch to nvm, you need to un-install node completely before installing nvm - or Google for trouble-shooting instructions, for example https://github.com/coreybutler/nvm-windows/issues/58#issuecomment-272608696.)
 
===Install ionic===
npm cache clean
npm install -g cordova@8.1.2 ionic    # (If it throws an EACCESS error, run it again with sudo)


===Install the npm required packages===
(It may seem simpler and easier to install directly from http://nodejs.org, but actually it is more tricky to get that to work. If you have previously installed Node directly, and want to switch to nvm, you need to uninstall node completely before installing nvm - or Google for trouble-shooting instructions, for example https://github.com/coreybutler/nvm-windows/issues/58#issuecomment-272608696.)
sudo npm install -g gulp                      # (This will install gulp in a folder that should be in the PATH)


===Windows only: Native build dependencies===
===Windows only: Native build dependencies===


node-gyp requires native build tools for your platform.  If you're developing on Mac or Linux, you'll probably have these already ([https://github.com/nodejs/node-gyp/blob/master/README.md refer to the docs if not]), on Windows, run the following command as administrator (in cmd or Powershell):
node-gyp requires native build tools for your platform.  If you're developing on Mac or Linux, you'll probably have these already ([https://github.com/nodejs/node-gyp/blob/master/README.md refer to the docs if you don't]). On Windows, run the following command as administrator (in cmd or Powershell):


  npm install --global --production windows-build-tools
  npm install --global --production windows-build-tools
Line 70: Line 61:


Clone the code base into a local directory in your computer.
Clone the code base into a local directory in your computer.
It may be an idea to work from the integration branch rather than master.
It may be a good idea to work from the integration branch rather than master.
  git clone https://github.com/moodlehq/moodleapp.git moodlemobiledirectory
  git clone https://github.com/moodlehq/moodleapp.git moodleapp
  cd moodlemobiledirectory
  cd moodleapp
  git checkout integration
  git checkout integration


Line 82: Line 73:
  npm run setup
  npm run setup


If this fails, you can see what it is doing by looking at the 'scripts' section in package.json. At the moment it is doing <tt>npm install && cordova prepare && gulp</tt>. That is, running three commands back-to-back, but only carrying on if the previous one succeeds completely. You can try running the three commands separately. If you do, <tt>ionic serve</tt> (see below) may work, even if <tt>cordova prepare</tt> gives errors. You only really need <tt>cordova prepare</tt> to work if you are going to go on and build the app.
If this fails, you can see what it is doing by looking at the 'scripts' section in package.json. At the moment it is doing <tt>npm install && npx cordova prepare && npx gulp</tt> (installing npm dependencies, preparing cordova and running default gulp tasks). That is, running three commands back-to-back, but only carrying on if the previous one succeeds completely. You can try running the three commands separately. If you do, <tt>npm start</tt> (see below) may work, even if <tt>npx cordova prepare</tt> gives errors. You only really need <tt>npx cordova prepare</tt> to work if you are going to go on and build the app for a mobile device or emulator.


== Open the app in the browser ==
== Open the app in the browser ==
First start Chromium via the command line using the custom parameters as is mentioned here: [[Moodle Mobile development using Chrome or Chromium]]
First start Chromium via the command line using the custom parameters as is mentioned here: [[Moodle Mobile development using Chrome or Chromium]]


and then, start the Ionic server:
Then, start the Ionic server:
 
ionic serve --browser chromium        # or chrome or whatever browser.
 
If you don't want to open any browser you should run:


  ionic serve -b
  npm start


Congratulations! Now that you have got to the point where the 'ionic serve' command works, you can start doing development on the app. You only need to read the rest of the page if you want to build packaged versions of the app.
Congratulations! Now that you have got to the point where the <tt>npm start</tt> command works, you can start doing development on the app. You only need to read the rest of the page if you want to build packaged versions of the app.


== Updating ionic and cordova ==
== Updating ionic and cordova ==
sudo npm update -g cordova
sudo npm update -g ionic


Update project platforms:
Update project platforms:


  ionic cordova platform remove android
  npx ionic cordova platform remove android
  ionic cordova platform remove ios
  npx ionic cordova platform remove ios
  ionic cordova platform add android
  npx ionic cordova platform add android
  ionic cordova platform add ios
  npx ionic cordova platform add ios


== Updating plugins ==
== Updating plugins ==


  cordova plugin remove your_plugin_id
  npx cordova plugin remove your_plugin_id
  cordova plugin add your_plugin_id
  npx cordova plugin add your_plugin_id


== Building for Android and iOS ==
== Building for Android and iOS ==
Line 122: Line 106:
iOS: https://cordova.apache.org/docs/en/latest/guide/platforms/ios/index.html
iOS: https://cordova.apache.org/docs/en/latest/guide/platforms/ios/index.html


If the build fails, please run <code>cordova requirements</code> to check that you fulfilled all requirements for the platform.
For convenience, you can use the following commands:
 
npm run dev:android
npm run dev:ios
npm run prod:android # Uses aot compilation, read below
npm run prod:ios        # Uses aot compilation, read below
 
If the build fails, please run <code>npx cordova requirements</code> to check that you fulfilled all requirements for the platform.


If you get errors while building, please see the Troubleshooting section below.
If you get errors while building, please see the Troubleshooting section below.


If using '''Ubuntu''' you should install the packages: gradle and libgradle-android-plugin-java (and all its dependencies) to build.
If using '''Ubuntu''' you should install the packages: <tt>gradle</tt> and <tt>libgradle-android-plugin-java</tt> (and all its dependencies) to build.


== Compiling using AOT ==
== Compiling using AOT ==


Angular has 2 ways of compiling: JIT and AOT. Running "ionic serve" or "ionic build" compiles using JIT by default, which is faster to compile but the app takes longer to start.
Angular has 2 ways of compiling: JIT and AOT. Running <tt>npm start</tt> or <tt>npx ionic build</tt> compiles using JIT by default, which is faster to compile but the app takes longer to start.


When building for release you should always compile using AOT, otherwise the app can take too long to start in some devices. The default AOT compiling causes some issues with the database activity and the [[Mobile support for plugins]], so you have to modify a couple of files in order to make this work.
When building for release you should always compile using AOT, otherwise the app can take too long to start in some devices. The default AOT compiling causes some issues with the database activity and the [[Mobile support for plugins]], so you have to modify a couple of files in order to make this work.
Line 205: Line 196:
=== Error: libsass bindings not found. Try reinstalling node-sass? ===
=== Error: libsass bindings not found. Try reinstalling node-sass? ===


Please read: http://fettblog.eu/gulp-and-node4-first-aid/, alternatively you must be sure that you installed Node v0.12
Sometimes running the following command will fix the problem:
 
node rebuild node-sass
 
If the issue persists, please read: http://fettblog.eu/gulp-and-node4-first-aid/, alternatively you must be sure that you installed Node v0.12


=== node-gyp\src\win_delay_load_hook.c(34): error C2373: '__pfnDliNotifyHook2': redefinition; different type modifiers ===
=== node-gyp\src\win_delay_load_hook.c(34): error C2373: '__pfnDliNotifyHook2': redefinition; different type modifiers ===
Line 268: Line 263:


If you see this error during <tt>npm setup</tt>, run <tt>mkdir www</tt> and retry.
If you see this error during <tt>npm setup</tt>, run <tt>mkdir www</tt> and retry.
=== ReferenceError: internalBinding is not defined ===
This [https://stackoverflow.com/questions/53146394/node-app-fails-to-run-on-mojave-referenceerror-internalbinding-is-not-defined seems to be] an error with 'natives' prior to 1.1.6. I fixed it using <tt>npm install natives@1.1.6</tt>.


=== ReferenceError: internalBinding is not defined ===
=== ReferenceError: internalBinding is not defined ===
Line 298: Line 289:
The solution seems to be removing and adding the iOS platform again:
The solution seems to be removing and adding the iOS platform again:


  ionic platform remove ios
  npx ionic platform remove ios
  ionic platform add ios
  npx ionic platform add ios


Note that this does not seem to prevent <tt>ionic --serve</tt> from serving a working app if you run gulp after <tt>npm run setup</tt> has failed with this error.
Note that this does not seem to prevent <tt>ionic --serve</tt> from serving a working app if you run gulp after <tt>npm run setup</tt> has failed with this error.
Line 307: Line 298:
The ''cordova-plugin-file'' version specified in config.xml is 6.0.1, for some reason the installation process installed a wrong version for that plugin. You can manually install the ''cordova-plugin-file'' plugin like this:
The ''cordova-plugin-file'' version specified in config.xml is 6.0.1, for some reason the installation process installed a wrong version for that plugin. You can manually install the ''cordova-plugin-file'' plugin like this:


  cordova plugin remove cordova-plugin-file
  npx cordova plugin remove cordova-plugin-file
  cordova plugin add cordova-plugin-file@6.0.1
  npx cordova plugin add cordova-plugin-file@6.0.1


Please notice that if there is any plugin installed that depends on ''cordova-plugin-file'' you'll have to remove and re-add them too.
Please notice that if there is any plugin installed that depends on ''cordova-plugin-file'' you'll have to remove and re-add them too.


Note that this does not seem to prevent <tt>ionic --serve</tt> from serving a working app if you run gulp after <tt>npm run setup</tt> has failed with this error.
Note that this does not seem to prevent <tt>npm start</tt> from serving a working app if you run <tt>npx gulp</tt> after <tt>npm run setup</tt> has failed with this error.


===Cannot download "https://github.com/sass/node-sass/releases/download/v4.11.0/linux-x64-72_binding.node"===
===Cannot download "https://github.com/sass/node-sass/releases/download/v4.11.0/linux-x64-72_binding.node"===
Line 328: Line 319:
Now try running the build again in XCode.
Now try running the build again in XCode.


===Windows: <code>npm run ionic:serve</code> hangs after "Starting 'watch'"===
===Windows: <code>npm start</code> hangs after "Starting 'watch'"===
This appears to have happened since the move to npx. Try running the npx commands generated by npm run directly in bash:
This appears to have happened since the move to npx. Try running the npx commands generated by npm run directly in bash:
   npx gulp watch & npx ionic-app-scripts serve -b --devapp --address=0.0.0.0
   npx gulp watch & npx ionic-app-scripts serve -b --devapp --address=0.0.0.0

Revision as of 15:16, 29 June 2020

This template is unused and can be deleted.

Note: These instructions do work (give or take) for the current 3.5.x version of the Moodle Mobile app.

Overview

The structure of this page is

  • the first part, up to the point where you get the npm start command to work is what you need to be able to do development on the app and test it in a browser.
  • the second part is about how to build a version of the app that can be run on a device.
  • then at the end is a list of troubleshooting advice. If you encounter a problem that is not already listed, please consider adding it.

The majority of your development will be done using a browser. You will probably only begin to use an emulator once you need to simulate a real mobile device.

If you are just adding mobile support to plugins, remember that most of your development can be done using the online pre-built version at https://mobileapp.moodledemo.net/ (with Chrome or Chromium). However, if you want to be able to to write automated acceptance tests for the app then you need to follow this page at least as far as getting the npm start command to work on this page.

Requirements

Windows tip: ingore any use of the sudo command below. Just use the command without it. Most things work that way. And if they don't, try in a Powershell window that you have opened with 'Run as administrator ...'.

Install a browser for development

We recommend Chromium browser (Google Chrome open source version) https://download-chromium.appspot.com/ Please, read Moodle_Mobile_development_using_Chrome_or_Chromium for more information

Install git

https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

Install Node.js

On Linux we recommend you use nvm - this lets you switch Node versions, and makes the installation a bit easier than the official installation route.

nvm install node
nvm use 11 # This is important, npm commands will not work in other versions

On Windows we recommend you use https://github.com/coreybutler/nvm-windows. Same nvm commands as for Linux.

On Mac we recommend installing NodeJS via Macports.

(It may seem simpler and easier to install directly from http://nodejs.org, but actually it is more tricky to get that to work. If you have previously installed Node directly, and want to switch to nvm, you need to uninstall node completely before installing nvm - or Google for trouble-shooting instructions, for example https://github.com/coreybutler/nvm-windows/issues/58#issuecomment-272608696.)

Windows only: Native build dependencies

node-gyp requires native build tools for your platform. If you're developing on Mac or Linux, you'll probably have these already (refer to the docs if you don't). On Windows, run the following command as administrator (in cmd or Powershell):

npm install --global --production windows-build-tools

Warning! this installer can take a very, very long time to run. We were seeing it take hours. Literally. Be prepared to be very patient. Don't just make the natural assumption that it has crashed.

Mac only: Push notifications

Phonegap plugin push 1.9.0 requires CocoaPods to work on a Mac. The installation steps can be found in https://cocoapods.org/

sudo gem install cocoapods
pod setup

Please note that for compiling the app in Mac you need to open the Moodle.xcworkspace file, more information here: MOBILE-1970

Clone the app base code

Clone the code base into a local directory in your computer. It may be a good idea to work from the integration branch rather than master.

git clone https://github.com/moodlehq/moodleapp.git moodleapp
cd moodleapp
git checkout integration

Setup the environment

Please, note that if you are creating a custom app with a custom URL scheme, you should edit the /package.json and /config.xml files and specify there your custom URL_SCHEME (replacing the existing value) and your GCMPN SENDER_ID.

The following command must be run in the project's root folder:

npm run setup

If this fails, you can see what it is doing by looking at the 'scripts' section in package.json. At the moment it is doing npm install && npx cordova prepare && npx gulp (installing npm dependencies, preparing cordova and running default gulp tasks). That is, running three commands back-to-back, but only carrying on if the previous one succeeds completely. You can try running the three commands separately. If you do, npm start (see below) may work, even if npx cordova prepare gives errors. You only really need npx cordova prepare to work if you are going to go on and build the app for a mobile device or emulator.

Open the app in the browser

First start Chromium via the command line using the custom parameters as is mentioned here: Moodle Mobile development using Chrome or Chromium

Then, start the Ionic server:

npm start

Congratulations! Now that you have got to the point where the npm start command works, you can start doing development on the app. You only need to read the rest of the page if you want to build packaged versions of the app.

Updating ionic and cordova

Update project platforms:

npx ionic cordova platform remove android
npx ionic cordova platform remove ios
npx ionic cordova platform add android
npx ionic cordova platform add ios

Updating plugins

npx cordova plugin remove your_plugin_id
npx cordova plugin add your_plugin_id

Building for Android and iOS

Please see the guides below to be able to build for Android and iOS using the command line:

Android: https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html

iOS: https://cordova.apache.org/docs/en/latest/guide/platforms/ios/index.html

For convenience, you can use the following commands:

npm run dev:android
npm run dev:ios
npm run prod:android # Uses aot compilation, read below
npm run prod:ios        # Uses aot compilation, read below

If the build fails, please run npx cordova requirements to check that you fulfilled all requirements for the platform.

If you get errors while building, please see the Troubleshooting section below.

If using Ubuntu you should install the packages: gradle and libgradle-android-plugin-java (and all its dependencies) to build.

Compiling using AOT

Angular has 2 ways of compiling: JIT and AOT. Running npm start or npx ionic build compiles using JIT by default, which is faster to compile but the app takes longer to start.

When building for release you should always compile using AOT, otherwise the app can take too long to start in some devices. The default AOT compiling causes some issues with the database activity and the Mobile support for plugins, so you have to modify a couple of files in order to make this work.

First you need to open the file: node_modules/@angular/platform-browser-dynamic/esm5/platform-browser-dynamic.js. Search the variable called "_NO_RESOURCE_LOADER", you'll see it has a function named "get" with this line:

throw new Error("No ResourceLoader implementation has been provided. Can't read the url \"" + url + "\"");

Remove that line and put this code instead:

       url = 'templates/' + url;
       var resolve;
       var reject;
       var promise = new Promise(function (res, rej) {
           resolve = res;
           reject = rej;
       });
       var xhr = new XMLHttpRequest();
       xhr.open('GET', url, true);
       xhr.responseType = 'text';
       xhr.onload = function () {
           // responseText is the old-school way of retrieving response (supported by IE8 & 9)
           // response/responseType properties were introduced in ResourceLoader Level2 spec (supported by IE10)
           var response = xhr.response || xhr.responseText;
           // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
           var status = xhr.status === 1223 ? 204 : xhr.status;
           // fix status code when it is 0 (0 status is undocumented).
           // Occurs when accessing file resources or on Android 4.1 stock browser
           // while retrieving files from application cache.
           if (status === 0) {
               status = response ? 200 : 0;
           }
           if (200 <= status && status <= 300) {
               resolve(response);
           }
           else {
               reject("Failed to load " + url);
           }
       };
       xhr.onerror = function () { reject("Failed to load " + url); };
       xhr.send();
       return promise;

We tried to replace the default loader with our own implementation, but we weren't able to make the compiler work so the only solution left was to modify the default one.

Now you need to open the file: node_modules/@ionic/app-scripts/dist/util/config.js. In that file you need to remove the context.isProd condition from the options optimizeJs. So the final code for that part should be like this:

   context.optimizeJs = [
       context.optimizeJs,
       hasArg('--optimizeJs')
   ].find(function (val) { return typeof val === 'boolean'; });

We want to compile in production mode but without optimizing Javascript because that breaks our plugins support. However, Ionic doesn't let you do that, so the only option is to do this change.

With these changes done you can now compile using production mode:

npm run ionic:build -- --prod

This command will generate the app files and put them inside www folder. If you now want to install that app in a real device you can run "cordova run android" or "cordova build ios" (please don't use "ionic cordova ..." or "ionic serve" because it will override your build files!).

Troubleshooting

Strange NPM errors

To get more debug output from npm commands, see https://docs.npmjs.com/misc/config#shorthands-and-other-cli-niceties. In particular try adding --loglevel verbose (or --loglevel info or --loglevel silly) to the command-line.

Error: libsass bindings not found. Try reinstalling node-sass?

Sometimes running the following command will fix the problem:

node rebuild node-sass

If the issue persists, please read: http://fettblog.eu/gulp-and-node4-first-aid/, alternatively you must be sure that you installed Node v0.12

node-gyp\src\win_delay_load_hook.c(34): error C2373: '__pfnDliNotifyHook2': redefinition; different type modifiers

Try updating npm to the latest version using:

 npm install -g npm@latest


com.android.dex.DexException: Multiple dex files define XXX

Open the file platforms/android/build.gradle and add this code at the end:

 configurations {
     all*.exclude group: 'com.android.support', module: 'support-v4'
 }

Could not resolve all dependencies for configuration ':_debugCompile'.

Open the Android SDK Manager and make sure you have installed: Android Support Repository, Android Support Library, Google Play Services and Google Repository.

Could not find com.android.support:support-v4:XXX

Open the file platforms/android/build.gradle and add this code at the end:

 configurations.all {
     resolutionStrategy.force 'com.android.support:support-v4:24.0.0'
 }

ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:font

Open the file platforms/android/build.gradle and add this code at the end:

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
}

Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.

1. Download Android studio - https://developer.android.com/studio/

2. Copy the folder android-studio/plugins/android/lib/templates

3. Paste in the folder android-sdk-folder/Sdk/tools

Could not find com.android.support:support-v4:27.1.0

Open the file platforms/android/build.gradle and configure like this:

 allprojects {
     repositories {
         jcenter()
         maven {
             url "https://maven.google.com"
         }
     }
 }

Error: not found: make

If you see this error in Ubuntu, run sudo apt-get install build-essential and retry.

Current working directory is not a Cordova-based project.

If you see this error during npm setup, run mkdir www and retry.

ReferenceError: internalBinding is not defined

This seems to be an error with 'natives' prior to 1.1.6. I fixed it using npm install natives@1.1.6.

npm update check failed

I got the error

│                   npm update check failed                   │
│             Try running with sudo or get access             │ 
│            to the local update config store via             │
│ sudo chown -R $USER:$(id -gn $USER) C:\Users\username\.config │

on Windows because I installed too much as admin, and the suggested command does not work on Windows. The is to manually check the ownership of all the files in C:\Users\username\.config\configstore. In my case it was update-notifier-npm.json which got changed to be owned by Administrator.

Unhandled rejection Error: Command failed: C:\cygwin64\bin\git.EXE ...

You need to heed the advice at https://www.npmjs.com/package/npm#installing-on-cygwin. Cygwin users are not welcome in the Node world. However, you just need to ensure that Msysgit is on your windows path and that the cygwin bin folder is not. Then always use another shell like Powershell for your Moodle mobile development. (You don't need your Cygwin bin folder on the Windows path. It automatically gets added to the path when you lauch Cygwin bash.)

The product name change (<name> tag) in config.xml is not supported dynamically

According to Google, this happens when you create the iOS platform with a certain <name> and then you change that name in config.xml. It's weird that the installation process does that, it should create the platform with the right name unless it was changed manually.

The solution seems to be removing and adding the iOS platform again:

npx ionic platform remove ios
npx ionic platform add ios

Note that this does not seem to prevent ionic --serve from serving a working app if you run gulp after npm run setup has failed with this error.

Failed to install 'cordova-plugin-file-transfer': CordovaError: Version of installed plugin: "cordova-plugin-file@4.3.3" does not satisfy dependency plugin requirement "cordova-plugin-file@>=5.0.0".

The cordova-plugin-file version specified in config.xml is 6.0.1, for some reason the installation process installed a wrong version for that plugin. You can manually install the cordova-plugin-file plugin like this:

npx cordova plugin remove cordova-plugin-file
npx cordova plugin add cordova-plugin-file@6.0.1

Please notice that if there is any plugin installed that depends on cordova-plugin-file you'll have to remove and re-add them too.

Note that this does not seem to prevent npm start from serving a working app if you run npx gulp after npm run setup has failed with this error.

Cannot download "https://github.com/sass/node-sass/releases/download/v4.11.0/linux-x64-72_binding.node"

Force using node 11, since node-sass for node 12 is not yet avalaible. See [https://tracker.moodle.org/browse/MOBILE-2999 MOBILE-2999] for more info.

Mac: linker code failed with exit code 1

If you get this error when trying to build the Moodle app with XCode, some dependencies might not have installed correctly.

Ensure you have followed the Mac only: Push notifications steps above (particularly opening the .xcworkspace file rather than the .xcodeproj file). Then run the following:

 npm run setup
 cd platforms/ios
 pod install

Now try running the build again in XCode.

Windows: npm start hangs after "Starting 'watch'"

This appears to have happened since the move to npx. Try running the npx commands generated by npm run directly in bash:

 npx gulp watch & npx ionic-app-scripts serve -b --devapp --address=0.0.0.0

See also

http://ionicframework.com/docs/cli/