The software that needs to be installed is as follows:
Node.js
TypeScript
TypeScript Code Editor
HTTP server (optional)
Chrome (optional)
Egret
In this document, we mainly introduce the installation of Egret in a Windows 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 msi 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 msi 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
Select the installation directory, we keep the default options
Select the installation content and we will install all toolkits
Confirm the installation and click the "Install" button
Installation process
After the installation interface, your Node.js is installed in the C:/Program Files/nodejs/ directory, and the installation package will also install npm tools for you.
1.3 Verify Node.js
After the installation is complete, please start your command line tool 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.
Enter cmd in Start->Search to run the command line tool.
If node is not an internal or external command, nor a runnable program or batch file, it means the installation has failed. You can refer to the Node.js installation failure solution below or ask for help in our developer community.
1.4 Verification npm
Execute npm in the command line tool, and the following figure appears, indicating that your npm is installed correctly.
If npm appears, which is not an internal or external command, nor a runnable program or batch file, it means that the installation has failed. You can refer to the Node.js installation failure solution below or ask for help in our developer community.
1.5Node.js installation failure solution
After some Windows installation is completed, enter node and npm directly into cmd, and it may prompt that the command cannot be found. This is because the newly added Path path needs to be restarted before it can take effect. Just restart or use the absolute paths of node and npm to run the command.
2. Install TypeScript
2.1 Install TypeScript
When node.js is installed successfully, the node and npm commands can be used. TypeScript installation can be directly installed using the npm command. For detailed installation methods, please refer to the official website of TypeScript.
Enter the following command in the terminal: npm install -g typescript
The function of the npm install command is to install the specified Node.js library in the developer's system. Typescript is the name of the library. -g means to install this library to the global path
If the installation speed is very slow due to network problems, please use the npm install -g typescript --registry=http://r.cnpmjs.org command to access the domestic mirror version for installation.
2.2 Verify TypeScript
After the installation is successful, execute the tsc command, and you should see the following interface
3. Install the TypeScript code editor
3.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.
4. Install an HTTP server
4.1 Select a suitable HTTP server
Windows 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.
5. 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
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.
6. Download and install Egret
6.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.
6.2 Install Egret
Unzip the downloaded Egret engine compression package to the specified directory, which can be a directory on any disk, as shown in the figure:
Type in the command line tool to enter the decompressed directory. Since we place the decompressed file on the F: disk, we first enter the F disk, and the command is as follows:
f:
Then we enter the corresponding directory, as shown in the figure
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 current path in the command correct?
Is the current directory an Egret directory (there is a file named package.json in this directory)
Whether the current user of the system has administrator rights, this problem may occur if Egret is decompressed to the C drive.
6.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.
If the installation fails, please seek help in our developer community.