Mac系统下 ionic集成、项目的创建之一

   公司发展需要,所以成功入坑了ionic的开发,但是在刚刚开始集成的时候报了半天错,耽搁了不少时间,这里记下心得体会,希望对有出现相同问题的朋友们有帮助,这里先介绍Mac下iOS的项目创建;

环境需要Node.js,npm,Cordova,phoneGap平台
Node.JS
这里我直接去官网下载的:https://nodejs.org/en/(!!:LTS版的)

安装ionic、Cordova
这里我推荐直接安装版本,这里我是这样安装的
1.sudo cnpm install -g ionic [email protected];
2.sudo cnpm install -g [email protected];
3.cnpm是淘宝镜像(npm install -g cnpm –registry=https://registry.npm.taobao.org)

新建项目
ionic start myFirstApps —v2
这里我是指定版本,不出意外的话应该是成功的,如果卡在:

Downloading: https://github.com/driftyco/ionic-app-base/archive/master.zip Downloading: https://github.com/driftyco/ionic-starter-tabs/archive/master.zip Installing npm packages (may take a minute or two)...

并且报错:

Installing npm packages... Error with start undefined Error Initializing app: There was an error with the spawned command: npminstall There was an error with the spawned command: npminstallCaught exception:undefined

可以尝试下面的方法:
1. ionic start myFirstApps –skip-npm(先不进行依赖的安装);
2. 在项目成功创建后,进入项目目录,执行:cnpm install –save

综上:如果项目成功创建,那么,直接下面命令(在你的项目目录里)
ionicplatformaddios() ionic build ios (构建)
$ ionic emulate ios (模拟器运行),没安装的可以百度下,比较简单;

成功的样式

猜你喜欢

转载自blog.csdn.net/whjay520/article/details/75314581
今日推荐