运行ionic ios build时出错--prod --release

时间:2017-11-10 17:28:36

标签: ios ionic-framework plugins native

安装Themeable浏览器插件后,运行时收到此错误:

ionic cordova build ios --prod --release 

我能够毫无错误地构建ios --prod --release。谢谢:D

    Mac-Pro-de-chaker-2:cleantoufoulakids chakerkalai$ ionic cordova build ios --prod --realise
Running app-scripts build: --prod --platform ios --target cordova
[18:22:05]  build prod started ... 
[18:22:07]  clean started ... 
[18:22:07]  clean finished in 2 ms 
[18:22:07]  copy started ... 
[18:22:07]  ngc started ... 
Error: Metadata version mismatch for module /Users/chakerkalai/Desktop/cleantoufoulakids/node_modules/@ionic-native/core/decorators.d.ts, found version 4, expected 3
    at StaticSymbolResolver.getModuleMetadata (/Users/chakerkalai/Desktop/cleantoufoulakids/node_modules/@angular/compiler/bundles/compiler.umd.js:24474:34)
    at StaticSymbolResolver._createSymbolsOf (/Users/chakerkalai/Desktop/cleantoufoulakids/node_modules/@angular/compiler/bundles/compiler.umd.js:24260:46)
    at StaticSymbolResolver.getSymbolsOf (/Users/chakerkalai/Desktop/cleantoufoulakids/node_modules/@angular/compiler/bundles/compiler.umd.js:24241:14)
    at /Users/chakerkalai/Desktop/cleantoufoulakids/node_modules/@angular/compiler/bundles/compiler.umd.js:23023:30
    at Array.forEach (native)
    at extractProgramSymbols (/Users/chakerkalai/Desktop/cleantoufoulakids/node_modules/@angular/compiler/bundles/compiler.umd.js:23022:79)
    at AotCompiler.compileAll (/Users/chakerkalai/Desktop/cleantoufoulakids/node_modules/@angular/compiler/bundles/compiler.umd.js:22720:47)
    at CodeGenerator.codegen (/Users/chakerkalai/Desktop/cleantoufoulakids/node_modules/@angular/compiler-cli/src/codegen.js:30:14)
    at Function.NgTools_InternalApi_NG_2.codeGen (/Users/chakerkalai/Desktop/cleantoufoulakids/node_modules/@angular/compiler-cli/src/ngtools_api.js:61:30)
    at Object.doCodegen (/Users/chakerkalai/Desktop/cleantoufoulakids/node_modules/@ionic/app-scripts/dist/aot/codegen.js:6:51)
[18:22:47]  copy finished in 40.10 s 

5 个答案:

答案 0 :(得分:3)

所有关于库不匹配的版本。

确保您有"typescript": "2.4.0"而不是更新。

对于以"@ionic-native/..."开头的所有软件包,其版本应为4.3.0,而不是^开头。

请不要升级到rxjs 5.5,使用"rxjs": "5.4.3",因为他们更改了运营商导出/导入。

注意:如果您仍然遇到发现版本4,预期3 的问题,请从导致此问题的库版本中删除帽^

祝你好运!

答案 1 :(得分:2)

我猜测今天有ionic-native个依赖项之一(我可以在不到24小时之前构建)。

我能够通过删除package.json中^的所有ionic-native依赖项来解决这个问题:

发件人:

    "@ionic-native/app-version": "^4.2.1",
    "@ionic-native/background-fetch": "^4.2.1",
    "@ionic-native/badge": "^4.0.1",
    "@ionic-native/contacts": "^4.2.1",
    "@ionic-native/core": "^4.2.1",
    "@ionic-native/date-picker": "^4.2.1",
    "@ionic-native/deeplinks": "^4.2.1",
    "@ionic-native/file": "^4.2.1",
    "@ionic-native/geolocation": "^4.2.1",
    "@ionic-native/keyboard": "^4.2.1",
    "@ionic-native/local-notifications": "^4.2.1",
    "@ionic-native/mixpanel": "^4.2.1",
    "@ionic-native/native-geocoder": "^4.2.1",
    "@ionic-native/network": "^4.2.1",
    "@ionic-native/screen-orientation": "^4.2.1",
    "@ionic-native/social-sharing": "^4.2.1",
    "@ionic-native/speech-recognition": "^4.1.0",
    "@ionic-native/splash-screen": "^4.2.1",
    "@ionic-native/status-bar": "^4.2.1",

    "@ionic-native/app-version": "4.2.1",
    "@ionic-native/background-fetch": "4.2.1",
    "@ionic-native/badge": "4.0.1",
    "@ionic-native/contacts": "4.2.1",
    "@ionic-native/core": "4.2.1",
    "@ionic-native/date-picker": "4.2.1",
    "@ionic-native/deeplinks": "4.2.1",
    "@ionic-native/file": "4.2.1",
    "@ionic-native/geolocation": "4.2.1",
    "@ionic-native/keyboard": "4.2.1",
    "@ionic-native/local-notifications": "4.2.1",
    "@ionic-native/mixpanel": "4.2.1",
    "@ionic-native/native-geocoder": "4.2.1",
    "@ionic-native/network": "4.2.1",
    "@ionic-native/screen-orientation": "4.2.1",
    "@ionic-native/social-sharing": "4.2.1",
    "@ionic-native/speech-recognition": "4.1.0",
    "@ionic-native/splash-screen": "4.2.1",
    "@ionic-native/status-bar": "4.2.1",

答案 2 :(得分:1)

我想这是因为ngc版本不匹配,将@angular/*设置为5.0.1应解决问题:

"@angular/common": "5.0.1",
"@angular/compiler": "5.0.1",
"@angular/compiler-cli": "5.0.1",
"@angular/core": "5.0.1",
"@angular/forms": "5.0.1",
"@angular/http": "5.0.1",
"@angular/platform-browser": "5.0.1",
"@angular/platform-browser-dynamic": "5.0.1",

答案 3 :(得分:1)

我的问题似乎与"@ionic-native/core": "4.4.0"有关。当我降级为"@ionic-native/core": "4.3.3"时,我又可以ionic cordova build ios --prod --release再次"ionic-angular": "3.9.2"

"@angular/animations": "4.4.6",
"@angular/common": "4.4.6",
"@angular/compiler": "4.4.6",
"@angular/compiler-cli": "4.4.6",
"@angular/core": "4.4.6",
"@angular/forms": "4.4.6",
"@angular/http": "4.4.6",
"@angular/platform-browser": "4.4.6",
"@angular/platform-browser-dynamic": "4.4.6",
"@angular/platform-server": "4.4.6",

"@ionic-native/camera": "4.3.3",
"@ionic-native/core": "4.3.3",
"@ionic-native/device": "4.3.3",
"@ionic-native/diagnostic": "4.3.3",
"@ionic-native/file": "4.3.3",
"@ionic-native/http": "4.3.3",
"@ionic-native/media": "4.3.3",
"@ionic-native/media-capture": "4.3.3",
"@ionic-native/native-storage": "4.3.3",
"@ionic-native/social-sharing": "4.3.3",
"@ionic-native/splash-screen": "4.3.3",
"@ionic-native/status-bar": "4.3.3",
"@ionic-native/themeable-browser": "4.3.3"

很遗憾我无法升级到"@angular/core": "5.0.1",因为"ionic-angular": "3.9.2"仍然依赖于"@angular/core": "4.4.6"

答案 4 :(得分:0)

我发现最好的解决方案是访问https://update.ionic.zone/,并获取更新的package.json文件。它将所有依赖项更新为所需版本。