ionic1迁移至ionic2

日期:2016-2-21 12:32 | 标签: | 阅读:542

Step1: 安装

升级通知:https://blog.ionic.io/announcing-ionic-2-0-0-final/?_ga=1.116616006.172394045.1470627403
迁移教程:http://ionicframework.com/files/Ionic2Migration.pdf


ionic start app tabs --v2
# 报错:Cannot find module config-chain
npm install -g config-chain
npm install -g osenv(A)
npm install -g umask
npm install -g npmlog
npm install -g ini(A)
npm install -g uid-number
npm install -g npm-registry-client
npm install -g chownr
npm install -g dezalgo
npm install -g npm-cache-filename
# 受不了了
npm update -g cordova ionic --registry=https://registry.npm.taobao.org
# 不行
npm cache clean
# 不行
npm uninstall -g ionic 
npm cache clean
npm install -g ionic --registry=https://registry.npm.taobao.org
# 不行  Cannot find module 'C:\Users\lenovo\AppData\Roaming\npm\node_modules\ionic\bin\ionic'
npm uninstall -g cordova
npm cache clean
npm install -g cordova--registry=https://registry.npm.taobao.org
# 不行  Cannot find module 'C:\Users\lenovo\AppData\Roaming\npm\node_modules\ionic\bin\ionic'
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install -g cordova ionic
# Cannot find module 'mz/fs'
npm install -g cordova ionic --registry=https://registry.npm.taobao.org
npm update -g cordova ionic  --registry=https://registry.npm.taobao.org
ionic start app tabs --v2
# 成功(npm包无法安装成功)

IOS

# 报错:Cannot find module
which
char-spinner
path-is-inside (Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL)
fs-vacuum
sync-some

经验:都卸载,再安装就对了,否则得纠结老半天。

Step2: 运行

npm install --registry=https://registry.npm.taobao.org
ionic serve
# Cannot find module @ionic\app-scripts\bin\ionic-app-scripts( 预估又是node-sass搞的鬼 )
npm i @ionic/app-scripts
# 安装失败
npm i node-sass --registry=https://registry.npm.taobao.org
# 安装失败
SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ npm install node-sass
# 安装成功
ionic serve
# Cannot find module @ionic\app-scripts\bin\ionic-app-scripts
npm install -g cordova --registry=https://registry.npm.taobao.org
# 安装成功
ionic serve
# Cannot find module @ionic\app-scripts\bin\ionic-app-scripts
npm i @ionic/app-scripts --registry=https://registry.npm.taobao.org
ionic serve
# 成功

构建

注意 ionic2 和 ionic1的构建稍微有不同,需要注意区分

ionic run android --prod --release
# or
ionic build android --prod --release
ionic build ios
# 提示 ios-deploy 版本不对
npm install -g ios-deploy

Step3:发问

http://stackoverflow.com/questions/42437944/ionic-add-platform-android-ios-cannot-find-module-config-chain

I want to upgrade my ionic version. so i just run 
> npm install -g ionic cordova  

seems successfully installed. but when i run 
> ionic add platform android/ios 

it shows ***Cannot find module config-chain***. so. 
i just follow the instructions and install the **config-chain** module.
 and another module just comes up :(. so and so..after about 10 module installed.
 it shows ***Probably this is either a connection problem,
 or platform spec is incorrect...***.  

oh~ anyone shows up to help me!?  thanks~~~

ERROR

IONIC3(2017_07_18)

ionic3 出世了,是时候升级了,

npm update -g cordova ionic

升级后,ionic1.x 项目 build 时需要做相应修改 IonicCLI3_Ionic1

参考

版权声明: 署名-非商业性使用-禁止演绎 4.0 国际(CC BY-NC-ND 4.0
Copyright ©2013-2017 | 粤ICP备14081691号 | yipeng手工打造 | 联系方式