VS2017 Cordova Ionic2 Mobile Development - Environment Construction

Original: VS2017 Cordova Ionic2 Mobile Development - Environment Construction

1. Documentation overview

    This document is used to describe the runtime environment configuration for cross-platform development with Ionic 2 under Visual Studio 2017.

2. Installation environment

    Windows10

3. Install Visual Studio 2017 community

   3.1 Official download address: https://www.visualstudio.com/downloads/

   3.2 To run the installer, you need to select Mobile development using JavaScript, as shown in the figure below.

3.3 VS2017 extended Ionic2 installation

3.3.1 Run VS2017, click Tools->Extensions and Updates in the menu bar

3.3.2 Install NPM Task Runner

     On the left side of the extension and update window, click Online search for NPM Task Runner on the right side, and click Download after finding it.

    

3.3.3 Install Ionic2 

Search for Ionic2 as in 3.3.2, find Ionic 2 Templates for Visual Studio 2017, and click to download

3.3.4 Close Visual Studio 2017 and start installing the two extensions downloaded above.

 

Or do not use the above method, after installing node.js, execute on the command line: npm install -g cordova ionic 

 

3.4 Building an Ionic2 project

 

After clicking OK, you can see that the Solution Explorer dependencies on the right are being restored.

If the restore fails, please use a proxy tool such as VPN FQ.

 

3.5 Running

If all goes well and all dependencies are restored successfully, you can start executing at this time.

It will take a while to run, and you will see the following interface in the browser later, indicating complete success.

 

 

3.6 But, is it so smooth? !

I am restoring the dependencies here, even with the proxy and vpn turned on, there is still an error @ionic/app-scripts is not installed

3.6.1 Solution

Enter the Windows command prompt.

输入: npm install @ionic/app-scripts@latest --save-dev 

If it is executed successfully, enter VS2017 again and you will find that @ionic/app-scripts has been updated.

3.6.2 However, when executing the above command, the

Cannot download "https://github.com/sass/node-sass/releases/download/v4.5.0/win32-x64-51_binding.node":

How to solve it:

1. Manually download the link indicated above in the browser and save the file to a certain directory

2. Then enter the windows command prompt: set SASS_BINARY_PATH=E:/Tools/win32-x64-51_binding.node

3. Run npm install @ionic/app-scripts@latest --save-dev again 

OK, success.

3.6.1 If none of the above commands can be executed, maybe you need to download and update Node.js

Official website download: https://nodejs.org/en/

After the installation is complete, there will be a Node.js command prompt shortcut in the Windows start menu.

Click this shortcut to execute the above npm command in this window

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325685782&siteId=291194637