Home >Web Front-end >JS Tutorial >Development environment for installing and deploying Egret under Windows system_node.js

Development environment for installing and deploying Egret under Windows system_node.js

WBOY
WBOYOriginal
2016-05-16 16:40:451990browse

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 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 Node.js official website, and then click the INSTALL button on the page to directly download the msi installation file package of Node.js.

Development environment for installing and deploying Egret under Windows system_node.js

When this tutorial was written, the 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, it means that your version is suitable for Egret.
Double-click the msi installation package and we start installing Node.js. The installation process is as shown in the figure:

Development environment for installing and deploying Egret under Windows system_node.js install

Downloaded Node.js installation package

1.2 Install Node.js

Development environment for installing and deploying Egret under Windows system_node.js install

Start the installation interface

Development environment for installing and deploying Egret under Windows system_node.js install

License Authorization Instructions

Development environment for installing and deploying Egret under Windows system_node.js install

Select the installation directory, we keep the default options

Development environment for installing and deploying Egret under Windows system_node.js install

Select the installation content and we will install all tool packages

Development environment for installing and deploying Egret under Windows system_node.js install

Confirm installation and click the "Install" button

Development environment for installing and deploying Egret under Windows system_node.js install

Installation process

Development environment for installing and deploying Egret under Windows system_node.js install

In the installation completion interface, your Node.js is installed in the C:Program Filesnodejs directory. At the same time, the installation package will also install the npm tool for you.

1.3 Verification 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 Development environment for installing and deploying Egret under Windows system_node.js is installed successfully. If installed correctly, the effect should appear as shown below.

Development environment for installing and deploying Egret under Windows system_node.js install

Enter cmd in Start -> Search to run the command line tool.

Development environment for installing and deploying Egret under Windows system_node.js install

Development environment for installing and deploying Egret under Windows system_node.js install

If node is not an internal or external command, nor is it an operable program or batch file, it means the installation failed. You can refer to the Node.js installation failure solution below or seek help in our developer community.

1.4 verified npm

Execute npm in the command line tool, and the following image will appear, indicating that your npm is installed correctly.

Development environment for installing and deploying Egret under Windows system_node.js install

If npm is not an internal or external command, nor is it an operable program or batch file, it means the installation failed. You can refer to the Node.js installation failure solution below or seek help in our developer community.

1.5Node.js installation failure solution

After some Windows installations are completed, if you directly enter node and npm in cmd, you may be prompted that the command cannot be found. This is because the newly added Path needs to be restarted to take effect. Restart or use the absolute path 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 can be installed directly using the npm command. For detailed installation methods, please refer to the TypeScript official website.

Enter the following command in the terminal: npm install -g typescript

The npm install command is used 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

Development environment for installing and deploying Egret under Windows system_node.js install
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 Validation TypeScript

After successful installation, execute the tsc command and you should see the following interface

Development environment for installing and deploying Egret under Windows system_node.js install

3. Install TypeScript code editor

3.1 Choose a suitable code editor

Egret can be used with 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 Choose a suitable HTTP server

Windows users are recommended to use 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 users to install the above-mentioned more mature HTTP server

For specific server software installation, you can refer to the tool-related chapters in the document.

5. Install Chrome browser

Egret can run on most 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 the JavaScript console (lower right corner) Settings (gear icon) -> Common -> Disable browser cache
After the above settings are made, as long as the JavaScript console is open, there will be no browser cache, which facilitates debugging.

6. Download and install Egret

6.1 Download Egret from the official website

Egret provides two download channels, one is Egret official download, and the other is Egret Github download.

We recommend that you 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 a stable version, you may encounter many problems in actual development, which usually do not appear in the stable version.

We open the official download page, find the "Egret Engine" product project, click the blue download button, and download the latest version of the Egret engine, as shown in the picture.

Development environment for installing and deploying Egret under Windows system_node.js install

6.2 Install Egret

Extract the downloaded Egret engine compressed package to the specified directory, which can be a directory on any disk, as shown in the figure:

Development environment for installing and deploying Egret under Windows system_node.js install

Development environment for installing and deploying Egret under Windows system_node.js install

Type the command in the command line tool to enter the decompressed directory. Since we will place the decompressed files in the F: drive, we first enter the F drive and the command is as follows:

f:

Development environment for installing and deploying Egret under Windows system_node.js install

Then we enter the corresponding directory, as shown in the figure

Development environment for installing and deploying Egret under Windows system_node.js install

After entering this directory, we execute the installation command.

npm install -g

Development environment for installing and deploying Egret under Windows system_node.js install

If the installation command is wrong, please check the following three items to see if they are correct.
Is the current path in the command correct?
Whether the current directory is the Egret directory (there is a file named package.json in this directory)
Check 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 is successfully installed. If the installation is successful, it should appear as shown below.

Development environment for installing and deploying Egret under Windows system_node.js install

If installation fails, please seek help from our developer community.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn