我正在尝试用--prod
构建我的应用程序,而我这样做我遇到了版本不匹配错误的问题,我认为它导致了ngx-restangular版本,我该如何解决这个问题来制作我的应用程序以prod模式运行,当我在dev
模式下运行我的应用程序时,启动画面需要更多时间,因此在研究时,我得到了一个以prod
模式运行应用程序的解决方案,同时这样做我得到以下错误。
我得到的错误:
Error: Metadata version mismatch for module D:/Tineri-v3/node_modules/ngx-restangular/node_modules/@angular/core/core.d.ts, found version 4, expected 3
at StaticSymbolResolver.getModuleMetadata (D:\Tineri-v3\node_modules\@angular\compiler\bundles\compiler.umd.js:24474:34)
at StaticSymbolResolver._createSymbolsOf (D:\Tineri-v3\node_modules\@angular\compiler\bundles\compiler.umd.js:24260:46)
at StaticSymbolResolver.getSymbolsOf (D:\Tineri-v3\node_modules\@angular\compiler\bundles\compiler.umd.js:24241:14)
at D:\Tineri-v3\node_modules\@angular\compiler\bundles\compiler.umd.js:23023:30
at Array.forEach (<anonymous>)
at extractProgramSymbols (D:\Tineri-v3\node_modules\@angular\compiler\bundles\compiler.umd.js:23022:79)
at AotCompiler.compileAll (D:\Tineri-v3\node_modules\@angular\compiler\bundles\compiler.umd.js:22720:47)
at CodeGenerator.codegen (D:\Tineri-v3\node_modules\@angular\compiler-cli\src\codegen.js:30:14)
at Function.NgTools_InternalApi_NG_2.codeGen (D:\Tineri-v3\node_modules\@angular\compiler-cli\src\ngtools_api.js:61:30)
at D:\Tineri-v3\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:182:73
package.json::
{
"name": "myappionic",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "4.1.3",
"@angular/compiler": "4.1.3",
"@angular/compiler-cli": "4.1.3",
"@angular/core": "4.1.3",
"@angular/forms": "4.1.3",
"@angular/http": "4.1.3",
"@angular/platform-browser": "4.1.3",
"@angular/platform-browser-dynamic": "4.1.3",
"@ionic-native/android-permissions": "^4.5.3",
"@ionic-native/app-version": "^4.5.3",
"@ionic-native/camera": "^4.6.0",
"@ionic-native/clipboard": "^4.6.0",
"@ionic-native/core": "3.12.1",
"@ionic-native/device": "^4.5.3",
"@ionic-native/diagnostic": "^4.5.3",
"@ionic-native/file": "^4.5.3",
"@ionic-native/file-opener": "^4.5.3",
"@ionic-native/file-transfer": "^4.5.3",
"@ionic-native/firebase": "^4.6.0",
"@ionic-native/geolocation": "^4.5.3",
"@ionic-native/google-analytics": "^4.7.0",
"@ionic-native/http": "^4.5.3",
"@ionic-native/in-app-browser": "^4.5.3",
"@ionic-native/network": "^4.5.3",
"@ionic-native/photo-viewer": "^4.6.0",
"@ionic-native/social-sharing": "^4.5.3",
"@ionic-native/splash-screen": "3.12.1",
"@ionic-native/status-bar": "3.12.1",
"@ionic/storage": "2.0.1",
"@ngui/map": "^0.20.2",
"@types/googlemaps": "^3.30.7",
"angularfire2": "^5.0.0-rc.6",
"com-sarriaroman-photoviewer": "^1.1.16",
"cordova-android": "7.0.0",
"cordova-clipboard": "^1.1.1",
"cordova-ios": "4.5.4",
"cordova-plugin-advanced-http": "^1.9.1",
"cordova-plugin-android-permissions": "~1.0.0",
"cordova-plugin-app-version": "^0.1.9",
"cordova-plugin-camera": "^4.0.2",
"cordova-plugin-console": "^1.0.5",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-file-opener2": "^2.0.19",
"cordova-plugin-file-transfer": "~1.7.1",
"cordova-plugin-firebase": "^0.1.25",
"cordova-plugin-geolocation": "^4.0.1",
"cordova-plugin-google-analytics": "^1.8.3",
"cordova-plugin-inappbrowser": "^2.0.2",
"cordova-plugin-network-information": "^2.0.1",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-telerik-imagepicker": "^2.1.10",
"cordova-plugin-whitelist": "^1.3.1",
"cordova-plugin-x-socialsharing": "^5.3.1",
"cordova.plugins.diagnostic": "^4.0.0",
"es6-promise-plugin": "^4.1.0",
"firebase": "^4.11.0",
"ionic-angular": "3.6.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"jquery": "^3.3.1",
"moment": "^2.20.1",
"ngx-restangular": "^2.0.2",
"promise-polyfill": "^7.1.0",
"rxjs": "^5.5.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.12"
},
"devDependencies": {
"@ionic/app-scripts": "3.1.8",
"@ionic/cli-plugin-cordova": "1.6.2",
"@ionic/cli-plugin-ionic-angular": "1.4.0",
"typescript": "2.3.4"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-network-information": {},
"cordova-plugin-advanced-http": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-console": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-app-version": {},
"cordova-plugin-android-permissions": {},
"cordova-plugin-file": {},
"cordova-plugin-file-transfer": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-file-opener2": {},
"cordova.plugins.diagnostic": {},
"cordova-plugin-x-socialsharing": {},
"cordova-plugin-geolocation": {},
"com-sarriaroman-photoviewer": {},
"cordova-clipboard": {},
"cordova-plugin-camera": {},
"cordova-plugin-firebase": {},
"cordova-plugin-google-analytics": {}
},
"platforms": [
"ios",
"android"
]
}
}
离子信息:
cli packages: (C:\Users\midhun\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.19.1
ionic (Ionic CLI) : 3.19.1
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : android 7.0.0 ios 4.5.4
Ionic Framework : ionic-angular 3.6.0
System:
Node : v8.9.4
npm : 5.6.0
OS : Windows 7
请从这个问题中找到我,谢谢你们,以及
答案 0 :(得分:1)
首先删除或卸载ngx-restangular,然后只需更改你的包json文件:
首先尝试从版本号前面删除 Caret(^)
"dependencies": {
"ngx-restangular": "1.0.13"
}
然后运行:
npm install
这个原因是因为,其他依赖关系或角度需要特定版本来构建项目。
我希望这会有所帮助!