ionic项目目录文件创建步骤

ionic学习之初,先来学习如何自己创建项目的目录文件!

第一步:要装cordova和ionic,需先安装node.js,因为cordova和ionic需要通过命令在线安装。到node.js官网下载最新版本进行安装,安装完成后,在DOS下输入命令以验证是否安装成功。

node -v
npm -v

紧接着通过命令在线安装ionic和cordova。-g代表的是全局安装。

sudo npm install -g cordova ionic

验证是否安装成功:

cordova -v
ionic Info

第二步:打开一个项目目录文件所要放的文件夹,按住shift,右击打开powershell窗口,输入命令

ionic start myapp tabs

接着就会开始下载,只需等待即可

第三步:下载完成之后,你会看到页面上出现了一个提问,意思是:

? Install the free Ionic Appflow SDK and connect your app?

注意一定要回答NO

第四步:项目文件已经建立好,进入项目文件

cd myapp

进行启动验证是否成功

ionic serve

具体详细过程如下:

PS E:\ionic测试> ionic start myapp tabs
√ Preparing directory .\myapp - done!
√ Downloading and extracting tabs starter - done!

Installing dependencies may take several minutes.

     *   IONIC  DEVAPP   *

 Speed up development with the Ionic DevApp, our fast, on-device testing mobile app

  -     Test on iOS and Android without Native SDKs
  -     LiveReload for instant style and JS updates

 -->    Install DevApp: https://bit.ly/ionic-dev-app    <--

────────────────────────────────────────────────────────────

> npm i

> [email protected] install E:\ionic测试\myapp\node_modules\node-sass
> node scripts/install.js

Cached binary found at C:\Users\86188\AppData\Roaming\npm-cache\node-sass\4.11.0\win32-x64-64_binding.node

> [email protected] postinstall E:\ionic测试\myapp\node_modules\node-sass
> node scripts/build.js

Binary found at E:\ionic测试\myapp\node_modules\node-sass\vendor\win32-x64-64\binding.node
Testing binary
Binary is fine
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 1107 packages from 1048 contributors and audited 53270 packages in 326.519s
found 1 high severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

     *   IONIC  APPFLOW   *

 Supercharge your Ionic development with the Ionic Appflow SDK

  -    Push remote updates and skip the app store queue

 Learn more about Ionic Appflow: https://ion.link/appflow

────────────────────────────────────────────────────────────

? Install the free Ionic Appflow SDK and connect your app? No

[INFO] Next Steps:

       - Go to your newly created project: cd .\myapp
       - Run ionic serve within the app directory to see your app
       - Build features and components: https://ion.link/scaffolding-docs
       - Get Ionic DevApp for easy device testing: https://ion.link/devapp
PS E:\ionic测试> cd myapp
PS E:\ionic测试\myapp> ionic serve
> ng run app:serve --host=0.0.0.0 --port=8100
[ng] WARNING: This is a simple server for use in testing or debugging Angular applications
[ng] locally. It hasn't been reviewed for security issues.
[ng] Binding this server to an open connection can result in compromising your application or
[ng] computer. Using a different host than the one passed to the "--host" flag might result in
[ng] websocket connection issues. You might need to use "--disableHostCheck" if that's the
[ng] case.
[INFO] Waiting for connectivity with ng...
[INFO] Waiting for connectivity with ng...
[INFO] Waiting for connectivity with ng...
[INFO] Waiting for connectivity with ng...
[INFO] Waiting for connectivity with ng...

[INFO] Development server running!

       Local: http://localhost:8100
       External: http://192.168.20.47:8100, http://192.168.248.1:8100, http://192.168.18.1:8100

       Use Ctrl+C to quit this process

[INFO] Browser window opened to http://localhost:8100!

[ng] i 「wdm」: wait until bundle finished: /
[ng] Date: 2019-04-25T02:25:11.790Z
[ng] Hash: d77a878c802bacbbcc90
[ng] Time: 74119ms
[ng] chunk {common} common.js, common.js.map (common) 18.5 kB  [rendered]
[ng] chunk {es2015-polyfills} es2015-polyfills.js, es2015-polyfills.js.map (es2015-polyfills) 284 kB [initial] [rendered]
[ng] chunk {main} main.js, main.js.map (main) 32 kB [initial] [rendered]
[ng] chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 237 kB [initial] [rendered]
[ng] chunk {runtime} runtime.js, runtime.js.map (runtime) 8.9 kB [entry] [rendered]
[ng] chunk {styles} styles.js, styles.js.map (styles) 84.3 kB [initial] [rendered]
[ng] chunk {tab1-tab1-module} tab1-tab1-module.js, tab1-tab1-module.js.map (tab1-tab1-module) 6.33 kB  [rendered]
[ng] chunk {tab2-tab2-module} tab2-tab2-module.js, tab2-tab2-module.js.map (tab2-tab2-module) 4.52 kB  [rendered]
[ng] chunk {tab3-tab3-module} tab3-tab3-module.js, tab3-tab3-module.js.map (tab3-tab3-module) 4.52 kB  [rendered]
[ng] chunk {tabs-tabs-module} tabs-tabs-module.js, tabs-tabs-module.js.map (tabs-tabs-module) 7.55 kB  [rendered]
[ng] chunk {vendor} vendor.js, vendor.js.map (vendor) 4.36 MB [initial] [rendered]
[INFO] ... and 173 additional chunks
[ng] i 「wdm」: Compiled successfully.
发布了176 篇原创文章 · 获赞 185 · 访问量 8万+

猜你喜欢

转载自blog.csdn.net/Sophia_0331/article/details/89511440