Overview
Egret is based on typescript development, and the Typescript compilation tool TSC is based on node.js development. So during the installation process, we first need to install the underlying 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 the MAC environment. The installation steps are as follows.
1. Install Node.js
1.1 Download Node.js
Node.js installation method is very simple, we can visit the Node.js website, and then click on the Install button in the page, can directly download Node.js pkg installation packages.
When this tutorial is written, the Node.js version is 0.10.29, and if your version is higher than this version, we will provide the 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. Installation process as shown:
Node.js installation package after download
1.2 Installation Node.js
Start the Installation interface
License Authorization Notes
Consent to license authorization
Installation Type description
Provides administrator privileges, where your name is your administrator account name, along with the account password.
installation process
The installation completes the interface, your node.js is installed in the/usr/local/bin/nodedirectory, and the installation package will also install NPM tools for you.
1.3 Verification Node.js
When the installation is complete, please start your terminal, enter thenode -vcommand to view your current Node.js version, and verify that your Nodejs is successfully installed. If the installation is correct, the effect should appear as shown below.
If thenode: command not foundinstallation fails, refer to the following Node.js installation failure solution or ask for help in our [developer community].
1.4 Verify NPM
Executed in the terminalnpm, the following image appears, indicating that your NPM is installed correctly.
If this occursnpm: command not found, the installation fails, and you can refer to the following Node.js installation failure solution.
1.5node.js Installation Failure Solution
Some MacOS Install Nodejs pkg installation package will show installation failure, can be manually compiled by downloading Nodejs source code resolution.
2. Install the Typescript Code Editor
2.1 Select a suitable code Editor
Egret can use any code editor that supports scripting languages, including:
Webstorm Official Download Address
"Official recommendation" Microsoft Visual Studio + typescript plug-in sublime Text + typescript Plugin
Detailed editor installation methods, as well as plug-in configuration methods, refer to the documentation in the tool-related chapters.
3. Install an HTTP server
3.1 Select a suitable HTTP server
Mac users can use the system's own server, Mac users recommend using Xmapp
Users can also skip this step by using the Egret built-in simple HTTP server based on Node.js. But to ensure a better development experience, Egret recommends that users install the more sophisticated HTTP servers above
Specific Server Software installation, you can refer to the documentation tools related chapters.
4. Install Chrome Browser
Egret can run on most modern browsers, but Egret currently recommends that developers use Chrome as their primary development and debugging environment.
Open the Chrome browser settings-> tool->javascript Console in the JavaScript console (lower right corner) set (gear icon)-> Common-> Disable browser caching
When the above settings are made, as long as the JavaScript console is turned on, there will be no browser caching to facilitate debugging.
5. Download and install
Egret5.1 download from the official website Egret
Egret offers two download channels, one is Egret official download, and the other is Egret GitHub download.
We recommend downloading from the official website, which is the current stable version. If you download the development version of the engine from GitHub, the version is not stable, you may encounter a lot of problems in actual development, and these problems usually don't appear in the stable version.
We open the official download page, find the "Egret engine" product items, click on the Blue download button, download the latest version of the Egret engine, as shown.
5.2 Installation Egret
Extract the downloaded Egret engine compression pack into the specified directory, which can be a directory on any disk. In the terminal, typing the command into the unpacked directory.
cd ${egret_folder}
${egret_folder}the path that is decompressed for the Egret engine.
After entering the directory, we execute the install command.
npm install -g
If the installation command is wrong, check the following three items to see if it is correct.
cd ${egret_folder}The path in the command is correct.
Whether the current directory is a Egret directory (there is a file named under this directorypackage.json)
Whether the current user of the system has administrator rights, or if it is not administrator rights, follow thesudo sucommand.
5.3Egret Tool Validation
After the installation is complete, we executeegretthe command to see if the current Egret is successfully installed. If the installation succeeds, it should appear as shown in the following illustration.
6.Java
In the release phase of the Egret project, more than 7 Java environments are required and will be used when packaged as Android apps. Here is a demonstration of Java download and installation.
6.1 Download
A.java website's JDK7 download address
B. Baidu Image
6.2 Installation
A. Confirm that the Java version must be more than 7
B. Double-click Mount installation package
C. Double-click the icon to install
D. All the way Next
E. Attention to delegation of authority
F. Confirm