In previous articles, we have introduced how to install and deploy the Egret development environment in Windows. In this document, we will introduce how to install Egret and deploy Egret in Mac.
Egret is developed based on TypeScript, while tsc is developed based on Node. js. Therefore, during the installation process, we must first install the basic support tools. The software to be installed is as follows:
Node. jsTypeScript code editor HTTP server (optional) Chrome (optional) EgretJava
This document describes how to install 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. You can visit the Node. js official website and click the INSTALL button on the page to directly download the pkg installation package of Node. js.
At the time of this tutorial, the Node. js version is 0.10.29. If your version is later than this version, we will provide related version compatibility instructions. If no version compatibility instructions are provided, your version applies to Egret.
Double-click the pkg installation package to install Node. js. Installation Process
The downloaded Node. js installation package
1.2 install Node. js
Start installation Interface
License authorization instructions
Permit authorization
Installation type description
Provide administrator permissions. Here, the your name is your administrator account name and the account password is also provided.
Installation Process
After the installation is complete, your Node. js is installed/usr/local/bin/node
The installation package also installs the npm tool for you.
1.3 verify Node. js
After the installation is complete, start your terminal and enternode -v
Command to check your current Node. js version, and verify whether your Node. js installation is successful. If the installation is correct, the effect is shown in.
Ifnode: command not found
The installation fails. You can refer to the Node. js installation failure Solution Below or ask for help in our [developer community.
1.4 npm Verification
Runnpm
If the content appears, it indicates that your npm is correctly installed.
Ifnpm: command not found
The installation fails. For details, refer to the Node. js installation failure solution below.
1.5Node.js installation failure Solution
When installing the pkg installation package of nodejs in some MacOS, the installation fails. You can download the node. js source code and manually compile it.
2. Install the TypeScript code editor.
2.1 select an appropriate code editor.
Egret can use any code editor that supports scripting languages, including:
Official WebStorm
[Officially recommended] Microsoft Visual Studio 2012 + TypeScript plug-in Sublime Text + TypeScript plug-in
For more information about how to install the editor and how to configure the plug-in, see the related tools section in this document.
3. install an HTTP server
3.1 select an appropriate HTTP server.
Mac users can use their own servers. XMAPP is recommended for Mac users.
You can skip this step and use the simple HTTP server built in Egret Based on Node. js. However, to ensure a better development experience, Egret recommends that you install the above mature HTTP server.
For more information about server software installation, see the related tools section in this document.
4. Install Chrome
Egret can run on the vast majority of modern browsers, but Egret currently recommends developers to use Chrome as the main development and debugging environment.
Open Chrome browser settings-> Tools-> JavaScript console in JavaScript Console (lower right corner) settings (gear icon)-> Frequently-> disable browser cache
After the preceding settings are completed, as long as the JavaScript console is open, no browser cache is available for debugging.
5. Download and install
Egret5.1 download Egret from the official website
Egret provides two download channels: Egret official download and Egret Github download.
We recommend that you download the stable version from the official website. If you download the development version of the engine from github and the version is unstable, you may encounter many problems in actual development. These problems are usually not found in the stable version.
Go to the official download page, find the "Egret engine" product item, and click the blue Download button to download the latest version of the Egret engine ,.
5.2 install Egret
Decompress the downloaded Egret engine package to the specified directory, which can be any directory on the disk. Run the command in the terminal to enter the decompressed directory.
cd ${egret_folder}
Where${egret_folder}
The decompressed path for the Egret engine.
After entering the directory, run the installation command.
npm install -g
If the installation command is incorrect, check the following three items to see if they are correct.
cd ${egret_folder}
Command.
Whether the current directory is the Egret directory (there is a directory namedpackage.json
Files)
Whether the current user of the system has administrator permissions. If not, executesudo su
Command.
5.3Egret tool Verification
After the installation is complete, runegret
Command to check whether the current Egret is successfully installed. If the installation is successful, see.
6. Java
Java 7 or above is required in the release phase of the Egret project, which will also be used when packaged as an Android APP. The following shows how to download and install Java.
Download 6.1
A. JDK 7 on the Java website
B. Baidu Image
6.2 Installation
A. Check that the JAVA version must be later than 7.
B. Double-click the Mount installation package
C. Double-click the icon to install
D. All the way to Next
E. Pay attention to authorization
F. Confirm