mac下创建nativescript angular项目

 
step 1: install node.js
 
step 2: install the nativescript cli
2.1
npm install -g nativescript
2.2 verify the nativescript cli
tns
 
step 3: install ios and android requirements
3.1 window
 
3.2 macos
3.2.1
ruby -e "$(curl -fsSL https://www.nativescript.org/setup/mac)"
 
3.2.2
Do you have Xcode installed? (y/n)
 
我在执行时报error:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
Xcode is not installed or not configured properly. Download, install, set it up and run this script again.
 
执行一下命令,修改安装的位置
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
 
If you do not have Xcode installed, download and install it from App Store and run it once to complete its setup.
 
3.2.3
Allow the script to install Homebrew?
(Y)es/(N)o
 
3.2.4
Allow the script to install Google Chrome?
(Y)es/(N)o
 
You have chosen not to install Google Chrome. Some features of NativeScript may not work correctly if you haven't already installed it
 
3.2.5
Allow the script to install Java SE Development Kit 8?
(Y)es/(N)o
 
3.2.6
Allow the script to install Android SDK?
Note that if you type all you won't be prompted for subsequent installations
(Y)es/(N)o/(A)ll
 
如果检测报如下提示信息:
The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.
 
执行一下命令:
export ANDROID_HOME=/usr/local/share/android-sdk
 
3.2.7
Allow the script to install CocoaPods?
Note that if you type all you won't be prompted for subsequent installations
(Y)es/(N)o/(A)ll
 
 如果需要重新安装CocoaPods,步骤如下:
(1) Install CocoaPods
sudo gem install cocoapods
(2) Setup CocoaPods
pod setup
 
CocoaPods是OS X和iOS下的一个第三类库管理工具
 
3.2.8
Allow the script to install pip?
Note that if you type all you won't be prompted for subsequent installations
(Y)es/(N)o/(A)ll
 
https://pypi.python.org/simple/pip/
 
3.2.9
Allow the script to install six?
Note that if you type all you won't be prompted for subsequent installations
(Y)es/(N)o/(A)ll
 
 
'six' python package
 
3.2.10
Allow the script to install xcodeproj?
Note that if you type all you won't be prompted for subsequent installations
(Y)es/(N)o/(A)ll
 
 如果需要重新安装xcodeproj,步骤如下:
(1) Install
brew install xcproj
 
3.2.11
Do you want to install Android emulator? (y/n)
3.2.12
Do you want to install HAXM (Hardware accelerated Android emulator)? (y/n)
 
step 4: verify the set up
tns doctor
 
 
step 1: creating apps
tns create HelloWorld --template tns-template-blank-ng
 
step 2: navigate into your new app’s folder
cd HelloWorld
 
step 3: running apps
 
3.1 ios
tns run ios
 
3.2 Android
tns run android
 
在mac下,运行:tns run android,报以下错误。
Skipping node_modules folder! Use the syncAllFiles option to sync files from this folder.
Searching for devices...
Cannot find connected devices.
Emulator start failed with: No emulator image available for device identifier 'undefined'.
To list currently connected devices and verify that the specified identifier exists, run 'tns device'.
To list available emulator images, run 'tns device <Platform> --available-devices'.
解决方法:
(1)、安装android studio;
(2)、配置 ANDROID_HOME 路径:
export ANDROID_HOME=/Users/xiemengyun/Library/Android/sdk
(3)、创建新的 AVD。
 
 
posted @ 2018-08-16 17:29  MiyaMiya  阅读(420)  评论(0编辑  收藏  举报