我正在处理ionic 3应用程序,并使用“ ionic cordova build browser --prod ”命令-
出现错误错误:模块的元数据版本不匹配 C:/Users/con-backend/Desktop/dev_newRepo/con-dashboard/node_modules/ionic-tooltips/dist/tooltip-box.component.d.ts, 找到版本4,预期为3错误:模块的元数据版本不匹配 C:/Users/consectus-backend/Desktop/devHUB_newRepository/consectus-dashboard/node_modules/ionic-tooltips/dist/tooltip-box.component.d.ts, 找到版本4,预期为3 在StaticSymbolResolver.getModuleMetadata(C:\ Users \ consectus-后端\ Desktop \ devHUB_newRepository \ consectus-dashboard \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:24474:34) 在StaticSymbolResolver._createSymbolsOf(C:\ Users \ consectus-backend \ Desktop \ devHUB_newRepository \ consectus-dashboard \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:24260:46) 在StaticSymbolResolver.getSymbolsOf(C:\ Users \ consectus-后端\ Desktop \ devHUB_newRepository \ consectus-dashboard \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:24241:14) 在C:\ Users \ consectus-backend \ Desktop \ devHUB_newRepository \ consectus-dashboard \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:23023:30 在Array.forEach() 在extractProgramSymbols(C:\ Users \ consectus-backend \ Desktop \ devHUB_newRepository \ consectus-dashboard \ node_modules @ angular \ compiler \ bundles \ compiler.umd.js:23022:79)
这是我的package.json:-
{
"name": "ConDashboard",
"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/animations": "4.1.3",
"@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",
"@angular/router": "^7.0.4",
"@ionic-native/core": "^3.12.1",
"@ionic-native/deeplinks": "^4.20.0",
"@ionic-native/network": "^3.0.0",
"@ionic-native/splash-screen": "3.12.1",
"@ionic-native/status-bar": "3.12.1",
"@ionic/storage": "2.0.1",
"@reactivex/rxjs": "^5.5.3",
"@types/papaparse": "^4.5.2",
"chart.js": "^2.7.2",
"cordova-browser": "5.0.4",
"cordova-plugin-console": "^1.1.0",
"cordova-plugin-crosswalk-webview": "^2.4.0",
"cordova-plugin-splashscreen": "^4.1.0",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"crypto-js": "^3.1.9-1",
"ionic-angular": "^3.6.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionic-tooltips": "^3.0.0",
"ionicons": "3.0.0",
"moment": "^2.24.0",
"moment-duration-format": "^2.2.2",
"papaparse": "^4.6.0",
"rxjs": "^5.5.12",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.12"
},
"devDependencies": {
"@ionic/app-scripts": "2.1.4",
"node-sass": "^4.11.0",
"typescript": "2.3.4"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-console": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-crosswalk-webview": {}
},
"platforms": [
"browser"
]
}
}
答案 0 :(得分:1)
我在节点模块/@angular/compiler.bundles/complire.umd中进行了更改 因为在创建prod版本(离子cordova版本浏览器--prod)时遇到问题,所以我在下面的if条件中添加了错误条件。这解决了问题。
if (moduleMetadata['version'] != SUPPORTED_SCHEMA_VERSION && false) {
var /** @type {?} */ errorMessage = moduleMetadata['version'] == 2 ?
"Unsupported metadata version " + moduleMetadata['version'] + " for module " + module + ". This module should be compiled with a newer version of ngc" :
"Metadata version mismatch for module " + module + ", found version " + moduleMetadata['version'] + ", expected " + SUPPORTED_SCHEMA_VERSION;
this.reportError(new Error(errorMessage));
}