[09:11:17] build prod started ...
[09:11:17] clean started ...
[09:11:17] clean finished in 2 ms
[09:11:17] copy started ...
[09:11:17] ngc started ...
TypeError: Cannot read property 'codeGen' of undefined
当我ionic cordova build android --prod
出现此错误时,我可以ionic cordova build android or --release
无问题。
更新:
当我更新Ionic-CLI警告时
[WARN] Detected @ionic/cli-plugin-cordova in your package.json.
As of CLI 3.8, it is no longer needed. You can uninstall it:
npm uninstall --save-dev --save-exact @ionic/cli-plugin-cordova
[WARN] Detected @ionic/cli-plugin-ionic-angular in your package.json.
As of CLI 3.8, it is no longer needed. You can uninstall it:
npm uninstall --save-dev --save-exact @ionic/cli-plugin-ionic-angular
离子信息
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2
global packages:
Cordova CLI : 7.0.1
local packages:
@ionic/app-scripts : 2.1.3
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 2.0.0
System:
ios-deploy : 1.9.1
ios-sim : 6.0.0
Node : v6.11.0
npm : 3.10.10
OS : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b
使用选项1后
答案 0 :(得分:2)
我想您正在尝试使用Ionic 3 CLI编译离子2项目。
您可以采取两项措施来解决此错误:
1)卸载ionic3 CLI并安装ionic2 CLI(我不喜欢Ionic3是最新的功能更多)
npm uninstall -g ionic
npm install ionic@2.2.3
2)将您的项目升级到Ionic 3(优先且易于实施) 更新你的package.json:
"ionic-angular": "3.6.0"
"typescript": "2.3.4"
将所有Angular依赖项从2更新为
"@angular/* "= "4.0.0"
然后执行npm install
,您的问题可能会得到解决。
请参阅此Article以进行无缝迁移
答案 1 :(得分:0)
更新您的Ionic-CLI
npm install ionic@latest