Overview
Egret is developed based on TypeScript, and the TypeScript compilation tool tsc is developed based on Node.js. Therefore, during the installation process, we first need to install the basic support tools. The software that needs to be installed is as follows:
Node.jsTypeScript Code Editor HTTP Server (Optional) Chrome (Optional) EgretJava
In this document, we mainly introduce the installation of Egret in a Mac environment. The installation steps are as follows.
1. Install Node.js
1.1 Download Node.js
The installation method of Node.js is very simple. We can visit the official website of Node.js, and then click the INSTALL button on the page to directly download the Node.js pkg installation file package.
At the time of writing this tutorial, Node.js version was 0.10.29. If your version is higher than this version, we will provide relevant version compatibility instructions. If no version compatibility instructions are provided, your version is applicable to Egret.
Double-click the pkg installation package and we start installing Node.js. The installation process is shown in the figure:
Downloaded Node.js installation package
1.2 Install Node.js
Start the installation interface
License Authorization Description
Agree to license
Installation type description
Provide administrator permissions, here your name is your administrator account name and also provides account password.
Installation process
After the installation interface, your Node.js is installed in the /usr/local/bin/node directory, and the installation package will also install npm tools for you.
1.3 Verify Node.js
After the installation is completed, please start your terminal and enter the node -v command to check your current Node.js version, and verify whether your Nodejs is installed successfully. If the installation is correct, the effect should appear as shown in the figure below.
If node: command not found appears, it means the installation failed. You can refer to the following Node.js installation failure solution or ask for help in our [Developer Community].
1.4 Verification npm
Execute npm in the terminal, and the following figure appears, indicating that your npm is installed correctly.
If npm: command not found appears, it means the installation failed. You can refer to the following Node.js installation failure solution.
1.5 Node.js installation failure solution
Some MacOS installation failures will be displayed when installing nodejs' pkg installation package. You can manually compile and solve the problem by downloading nodejs source code.
2. Install the TypeScript code editor
2.1 Choose a suitable code editor
Egret can use any code editor that supports scripting languages, including:
WebStorm official download address
【Official Recommendation】Microsoft Visual Studio 2012 + TypeScript Plugin Sublime Text + TypeScript Plugin
For detailed editor installation methods and plug-in configuration methods, please refer to the tool-related chapters in the document.
3. Install an HTTP server
3.1 Select a suitable HTTP server
Mac users can use the server that comes with the system. Mac users recommend using XMAPP
Users can also skip this step and use Egret's built-in simple HTTP server based on Node.js. However, in order to ensure a better development experience, Egret recommends that users install the above-mentioned more mature HTTP server
For specific server software installation, you can refer to the relevant chapters of the tool in the document.
4. Install Chrome Browser
Egret can run on most modern browsers, but Egret currently recommends developers to use Chrome as their main development and debugging environment.
Open Chrome browser settings -> Tools -> JavaScript console Settings in JavaScript console (lower right corner) (gear icon) -> Common use -> Disable browser cache
After the above settings are made, as long as the JavaScript console is open, there will be no browser cache, which is convenient for debugging.
5. Download and install
Egret5.1 Download Egret from the official website
Egret provides two download channels, one is the official download of Egret, and the other is the Egret Github download.
We recommend everyone to download it from the official website, the version here is the current stable version. If you download the development version of the engine from github, which is not stable, you may encounter many problems in actual development, which usually do not appear in stable versions.
We open the official download page, find the "Egret Engine" product project, click the blue download button, and download the latest version of Egret Engine, as shown in the picture.
5.2 Install Egret
The downloaded Egret engine compression package is decompressed to the specified directory, which can be a directory on any disk. Type in the terminal to enter the decompressed directory.
cd ${egret_folder}
where ${egret_folder} is the path to decompress the Egret engine.
After entering this directory, we execute the installation command.
npm install -g
If the installation command is incorrect, please check the following three items to see if it is correct.
Is the path in
cd ${egret_folder}command correct?Is the current directory an Egret directory (there is a file named
package.jsonin this directory)Whether the current user of the system has administrator rights? If it is not administrator rights, please execute the
sudo sucommand.
5.3Egret tool verification
After the installation is completed, we execute the egret command to check whether the current Egret installation is successful. If the installation is successful, the following figure should appear.
6.Java
During the release stage of the Egret project, you need to use Java 7 or above, and you will also use it when you package it into an Android APP. The following is a demonstration of Java download and installation.
6.1 Download
a.JDK7 download address of Java official website
b. Baidu mirror
6.2 Installation
a. Confirm that the JAVA version must be 7 or above
b. Double-click to mount the installation package
c. Double-click the icon to install
d.All the way Next
e. Pay attention to authorization
f. Confirm