Ionic Mac OS Environment configuration

Source: Internet
Author: User

1. Install Nodejs plug-in

The official website (http://www.nodejs.org/) is inaccessible in China and can be downloaded and installed via (http://nodejs.cn/).

After installation at the command Terminal input: Node-v to see if the installation was successful

When the installation succeeds, the version information appears, and my Nodejs version is as follows:

2. Installation of Cordova and Ionic environment

1), install Cordova

sudo npm install-g Cordova

2), install Ionic

sudo npm install-g Ionic

3), note that when installing Cordova or ionic may be unable to install because of network problems, the workaround is as follows:

A. Through the Config command

Registry https://
Info underscore (if configured correctly this command will have string response)

B. Command-line designation

NPM--registry https://registry.npm.taobao.org Info underscore

C. Edit ~/.NPMRC Add the following:

Registry = https://registry.npm.taobao.org

After completion, you can view ionic information, enter ionic info

3. Create a project

Now, we need to create a new project using Cordova:

ionic start myApp blank
 

A command that runs in the folder directory named Todo is created. Next, we will enter the directory:

cd myApp

4. Configuration Platform

Now we need to tell Ionic that we want to make iOS and Android platforms. Note: Unless you are on Mac OS, do not use the iOS platform:

ionic platform ios (如果用的是Mac OS 创建工程的时候会默认添加ios 所以这步可以忽略)ionic platform android
5. Build and run the project
ionic build iosionic emulate ios

若在“ionic build ios”时候出现xcode-select: error:错误提示,Xcodebuild can't find the original Xcode.

Workaround: Enter the command in the terminal

Xcode-select-switch the new Xcode path

For example: sudo xcode-select--switch/applications/xcode.beat.app/contents/developer/

If you get an error when "Ionic emulate iOS", you'll need to install the iOS emulator

sudo npm install -g ios-sim

This is the perfect solution!!!

The next step is to run:

Ionic run (you can see the effect on the simulator)

If you need browser debugging, you can:

Ionic serve

Ionic Mac OS Environment configuration

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.