1. 程式人生 > >ionic2 The --v1 and --v2 flags have been removed.

ionic2 The --v1 and --v2 flags have been removed.

upd 分享 extract andro tab 開發 error 幫助 finished

安裝ionic2後,新建項目時出現了如題錯誤

>ionic start MyIonic2Project tutorial --v2
[ERROR] Sorry! The --v1 and --v2 flags have been removed.

        Use the --type option. (ionic start --help)

        For Ionic Angular projects, try ionic start MyIonic2Project tutorial --type=ionic-angular

命令提示v1和v2命令沒有了,應該是我看的教程不是最新的原因。去官網一看才知,人家默認生成的是ionic2的項目,如果是1的話需要加上--type=ionic1 命令。而我看的教程上說的是默認生成v1的項目。還是以官網為準啊。

解決:

> ionic start cutePuppyPics

 然後出現以下內容就是ok了

c>ionic start cutePuppyPics

? What starter would you like to use: sidemenu
√ Creating directory .\cutePuppyPics - done!
√ Downloading and extracting sidemenu starter - done!

? Would you like to integrate your new app with Cordova to target native iOS and Android? Yes
√ Personalizing ionic.config.json and package.json 
- done! > ionic integrations enable cordova --quiet √ Downloading integration cordova - done! √ Copying integrations files to project - done! [OK] Added cordova integration! 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 √ Running command - done! > git init * IONIC PRO * Supercharge your Ionic development with the Ionic Pro SDK - Track runtime errors in real-time, back to your original TypeScript - Push remote updates and skip the app store queue Learn more about Ionic Pro: https://ionicframework.com/products

期間會彈出幾個供你選項 的提示:

1、? What starter would you like to use:技術分享圖片

  • tabs:一個簡單的3選項卡布局
  • sidemenu:一個帶有菜單邊的布局
  • blank:一個帶有單一頁面的裸啟動器
  • super*啟動項目,有14多個準備使用頁面設計
  • tutorial*一個引導啟動項目

  我選的是sidemenu,官方上給的就是這個。

2、? Would you like to integrate your new app with Cordova to target native iOS and Android?

您想將您的新應用程序與cordova集成到本地ios和android嗎?YES

3、Install the free Ionic Pro SDK and connect your app?

是不是安裝Pro版幫助你開發? (NO) ^_^這就看你了 輸入yes的話會讓你登錄什麽的

然後進入項目目錄,執行 ionic serve

>ionic serve
Starting app-scripts server: --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser -
Ctrl+C to cancel
[21:17:12]  watch started ...
[21:17:12]  build dev started ...
[21:17:12]  clean started ...
[21:17:12]  clean finished in 3 ms
[21:17:12]  copy started ...
[21:17:12]  deeplinks started ...
[21:17:13]  deeplinks finished in 35 ms
[21:17:13]  transpile started ...
[21:17:17]  transpile finished in 4.01 s
[21:17:17]  preprocess started ...
[21:17:17]  preprocess finished in 6 ms
[21:17:17]  webpack started ...
[21:17:17]  copy finished in 4.33 s
[21:17:23]  webpack finished in 6.47 s
[21:17:23]  sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.

大功告成!

ionic2 The --v1 and --v2 flags have been removed.