Giter VIP home page Giter VIP logo

learn.nativescript's Introduction

nativescript入坑指北

NativeScript官网:https://www.nativescript.org

注:目前只踩了mac的坑

安装

首先默认各位都装好了node...也默认各位装好了HomeBrew...

tns

先安装ns的cli工具

$ npm install -g nativescript

如果这里出现了Permission denied的错误,请在开头加上sudo

安装完成后可以运行下面的命令

$ tns

当出现如下信息,表示已经安装成功

┌─────────┬─────────────────────────────────────────────────────────────────────┐
│ Usage   │ Synopsis                                                            │
│ General │ $ tns <Command> [Command Parameters] [--command <Options>]          │
│ Alias   │ $ nativescript <Command> [Command Parameters] [--command <Options>] │
└─────────┴─────────────────────────────────────────────────────────────────────┘

Xcode

安装完ns的脚手架,因为我们写的是原生应用,所以ios开发相关的工具也要一并装上。首先装个XCode,这个可以在App Store里安装。

Command Line Tools for Xcode

https://developer.apple.com/downloads/index.action下载Command Line Tools for Xcode并安装(如果有通过terminal使用git基本都装过的了)

xcodeproj

安装xcodeproj

$ sudo gem install xcodeproj

CocoaPods

接着安装CocoaPods

$ sudo gem install cocoapods

JDK8

同样的,安卓方面,也需要安装一系列的工具...

首先去装个JDK8,进去在 Java SE Development Kit里勾选同意,下载macos专用的版本,安装好后将export JAVA_HOME=$(/usr/libexec/java_home)添加到系统环境变量中:

$ cd ~
$ touch .bash_profile
$ vim .bash_profile
# 将export JAVA_HOME=$(/usr/libexec/java_home)追加到文件中

Android sdk

接着安装android sdk

$ brew cask install android-sdk

如无意外这里会报个错的: ) Error: Unknown command: cask,这里有官方解决办法,其实就是运行下面这行命令:

$ cd $(brew --repo); git fetch; git reset --hard origin/master; brew update

同样的,在安装完android-sdk后,将export ANDROID_HOME=/usr/local/share/android-sdk添加到~/.bash_profile

Addition

接着,运行下面这个命令,安装所有安卓所需的依赖包

$ $ANDROID_HOME/tools/bin/sdkmanager "tools" "platform-tools" "platforms;android-25" "build-tools;25.0.2" "extras;android;m2repository" "extras;google;m2repository"

注意,这里也有点坑,最好你的电脑能科(fan)学(qiang)上网,鄙人用的是4g搭配正确的科学姿势跑完的

然后

Android Studio

这里占个坑,android的模拟器还要装个Android Studio后补,并不影响接下来的操作

Check && Finishing

最后运行

$ tns doctor

这里就如它的提示一样,be patient..反正就是有点久,建议将npm源改为taobao或者cnpm(推荐�使用nrm管理)这样安装的过程会舒爽很多。

当最后出现'No issues were detected.',那么恭喜你,环境终于搭好了

learn.nativescript's People

Contributors

pupateyf avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.