Moodle for mobile

Mobile error

 
Picture of Mohit juyal
Mobile error
 

I tried to compile moodle mobile version 2 and getting these errors.


Error

Close

Typescript Error

Cannot find name 'module'.

D:/Moodle/moodlemobile2/src/core/course/directives/download-module-main-file.ts

}).finally(() => {

    modal.dismiss();

});

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/core/emulator/classes/inappbrowserobject.ts

    width = display.workArea.width || width;

    height = display.workArea.height || height;

}

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/core/emulator/classes/inappbrowserobject.ts

        height = display.workArea.height || height;

    }

}

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/core/emulator/emulator.module.ts

undefined

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/badge.ts

*

* @returns {Promise<any>}

*/

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/badge.ts

*/

increase(increaseBy: number): Promise<any> {

    return Promise.reject('increase is only supported in mobile devices');

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/clipboard.ts

* @param {string} text The text to copy.

* @return {Promise<any>} Promise resolved when copied.

*/

Typescript Error

'FileTransferError' only refers to a type, but is being used as a value here.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file-transfer.ts

    // In desktop we need to convert the arraybuffer into a Buffer.

    response = Buffer.from(<any> new Uint8Array(response));

}

Typescript Error

Cannot find name 'Buffer'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file-transfer.ts

* This code is extracted from Cordova FileTransfer plugin.

*

* @param {string} urlString The URL to get the credentials from.

Typescript Error

Cannot find name 'FileUploadOptions'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file-transfer.ts

    options.headers = options.headers || {};

    options.headers[basicAuthHeader.name] = basicAuthHeader.value;

}

Typescript Error

'FileTransferError' only refers to a type, but is being used as a value here.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file-transfer.ts

// Create a form data to send params and the file.

const fd = new FormData();

for (const name in params) {

Typescript Error

Cannot find name 'FileWriter'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file.ts

*

* @param {any} err Error.

*/

Typescript Error

Cannot find name 'FileWriter'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file.ts

* @param {any} err Error.

*/

private fillErrorMessageMock(err: any): void {

Typescript Error

Cannot find name 'Flags'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file.ts

        reject(xc);

    }

});

Typescript Error

Cannot find name 'Flags'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file.ts

        });

    }

 

Typescript Error

Property 'requestFileSystem' does not exist on type 'Window'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file.ts

    calculateByRequest(size * ratio, ratio).then(resolve);

}, () => {

    resolve(size / ratio);

Typescript Error

Property 'requestFileSystem' does not exist on type 'Window'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file.ts

 

                // General calculation, base 1MB and increasing factor 1.3.

                calculateByRequest(1048576, 1.3).then((size: number) => {

Typescript Error

Cannot find name 'LocalFileSystem'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file.ts

 

                // General calculation, base 1MB and increasing factor 1.3.

                calculateByRequest(1048576, 1.3).then((size: number) => {

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file.ts

                basePath = this.textUtils.concatenatePaths(basePath.replace(/\\/g, '/'), CoreConfigConstants.app_id) + '/';

 

                // Create the folder if needed.

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file.ts

 

                // Create the folder if needed.

                fs.mkdir(basePath, (e) => {

Typescript Error

Property 'requestFileSystem' does not exist on type 'Window'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file.ts

* @param {Entry} srce The Entry to copy.

* @param {DirectoryEntry} destDir The directory where to move the file/dir.

* @param {string} newName New name of the file/dir.

Typescript Error

Cannot find name 'LocalFileSystem'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file.ts

* @param {Entry} srce The Entry to copy.

* @param {DirectoryEntry} destDir The directory where to move the file/dir.

* @param {string} newName New name of the file/dir.

Typescript Error

Cannot find name 'DirectoryReader'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file.ts

*

* @param {string} path Base FileSystem.

* @param {string} file Name of file, relative to path.

Typescript Error

Property 'resolveLocalFileSystemURL' does not exist on type 'Window'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file.ts

/**

* Remove a directory and all its contents.

*

Typescript Error

Cannot find name 'FileWriter'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file.ts

        writer.write(data);

    });

}

Typescript Error

Cannot find name 'FileWriter'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/file.ts

writer.onwrite = (): void => {

    if (writtenSize < data.size) {

        writeNextChunk();

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/globalization.ts

* @return {Promise<{value: string}>} Promise resolved with an object with the language string.

*/

getLocaleName(): Promise<{ value: string }> {

Typescript Error

Cannot find name 'GlobalizationError'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/globalization.ts

    }

}

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/local-notifications.ts

delete notification.triggered;

this.scheduled[notification.id] = {

    notification: notification

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/local-notifications.ts

    }

    this.observers[eventName].push(callback);

}

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/push.ts

* successHandler gets called with an integer which is the current badge count

*/

getApplicationIconBadgeNumber(): Promise<number> {

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/core/emulator/providers/push.ts

*/

finish(id?: string): Promise<any> {

    return Promise.reject('finish is only supported in mobile devices');

Typescript Error

Cannot find name 'FileError'.

D:/Moodle/moodlemobile2/src/core/settings/pages/space-usage/space-usage.ts

        // Ignore cancelled confirmation modal.

    });

});

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/providers/app.ts

            return false;

        }

 

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/providers/app.ts

    }

 

    /**

Typescript Error

Cannot find name 'Connection'.

D:/Moodle/moodlemobile2/src/providers/app.ts

*/

isNetworkAccessLimited(): boolean {

    const type = this.network.type;

Typescript Error

Cannot find name 'Connection'.

D:/Moodle/moodlemobile2/src/providers/app.ts

*/

isNetworkAccessLimited(): boolean {

    const type = this.network.type;

Typescript Error

Cannot find name 'Connection'.

D:/Moodle/moodlemobile2/src/providers/app.ts

        }

 

        try {

Typescript Error

Cannot find name 'Connection'.

D:/Moodle/moodlemobile2/src/providers/app.ts

        }

 

        try {

Typescript Error

Cannot find name 'Connection'.

D:/Moodle/moodlemobile2/src/providers/app.ts

        }

 

        try {

Typescript Error

Cannot find name 'Connection'.

D:/Moodle/moodlemobile2/src/providers/app.ts

        }

 

        try {

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/providers/app.ts

        }

    }

 

Typescript Error

Property 'resolveLocalFileSystemURL' does not exist on type 'Window'.

D:/Moodle/moodlemobile2/src/providers/file.ts

    return this.file.resolveLocalFilesystemUrl(this.addBasePathIfNeeded(path));

}).then((entry) => {

    return <FileEntry> entry;

Typescript Error

Cannot find name 'Entry'.

D:/Moodle/moodlemobile2/src/providers/file.ts

* @param {string} path Path to the file/dir.

* @param {boolean} [isDir] True if directory, false if file.

* @return {Promise<any>} Promise resolved with metadata.

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/providers/utils/utils.ts

// Clone the array and all the entries.

const newArray = [];

for (let i = 0; i < source.length; i++) {

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/providers/utils/utils.ts

        }

    });

}

Typescript Error

Cannot find name 'require'.

D:/Moodle/moodlemobile2/src/providers/utils/utils.ts

*

* node-webkit: Using the default application configured.

* Android: Using the WebIntent plugin.




Ionic Framework: ^3.9.2

Ionic App Scripts: 3.1.8

Angular Core: 5.0.0

Angular Compiler CLI: 5.0.0

Node: 6.9.1

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/66.0.3359.139 Safari/537.36


 
Average of ratings: -
Picture of Dani Palou
Re: Mobile error
Core developersMoodle HQParticularly helpful MoodlersPlugin developers

Hi Mohit,

did you run npm install before trying to build the app? Some of the errors like the require one could be caused because you miss some npm packages.

Maybe npm install throws an error in Windows?

Cheers,

Dani

 
Average of ratings: -
Picture of Samuel Domingues
Re: Mobile error
 

I had the same error, you have to edit the tsconfig.json file and add this in the compilerOptions:


"typeRoots": [
"node_modules/@types"
]

 
Average of ratings: -
Picture of Mohit juyal
Re: Mobile error
 

Thanks, I'll do that

 
Average of ratings: -