我在项目中使用angular 4和angular cli,我只需安装ng2-img-max
来操作图像,然后再上传到我的firebase存储,但是当我运行ng server
时,我收到此错误: Metadata version mismatch for module C:/Users/Migue/Desktop/weddingAngular/node_modules/ng2-img-max/dist/ng2-img-max.d.ts, found version 4, expected 3, resolving symbol AppModule in C:/Users/Migue/Desktop/weddingAngular/src/app/app.module.ts, resolving symbol AppModule in C:/Users/Migue/Desktop/weddingAngular/src/app/app.module.ts
这是我的 package.json
{
"name": "wedding-angular",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^4.2.4",
"@angular/common": "^4.2.4",
"@angular/compiler": "^4.2.4",
"@angular/core": "^4.2.4",
"@angular/forms": "^4.2.4",
"@angular/http": "^4.2.4",
"@angular/platform-browser": "^4.2.4",
"@angular/platform-browser-dynamic": "^4.2.4",
"@angular/router": "^4.2.4",
"@ngx-translate/core": "^8.0.0",
"@ngx-translate/http-loader": "^2.0.0",
"angular-file-saver": "^1.1.3",
"angularfire2": "^5.0.0-rc.3",
"blueimp-canvas-to-blob": "^3.14.0",
"core-js": "^2.4.1",
"firebase": "^4.6.2",
"hammerjs": "^2.0.8",
"jszip": "^3.1.5",
"moment": "^2.19.2",
"ng2-animate-on-scroll": "^1.0.6",
"ng2-img-max": "^2.1.9",
"ng2-scroll-to": "^1.0.7",
"ngx-bootstrap": "^2.0.0-beta.9",
"ngx-carousel": "^1.3.2",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular/cli": "1.4.9",
"@angular/compiler-cli": "^4.2.4",
"@angular/language-service": "^4.2.4",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "~3.2.0",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.3.3"
}
}
任何想法可能是什么问题。
答案 0 :(得分:1)
将ng2-img-max
的版本降级为2.1.0
,因为开发人员更新2.1.4
中的依赖项以支持角度5。
有关更多信息,请参阅2.1.4
的提交:
https://github.com/bergben/ng2-img-max/compare/2.1.4...master
您会看到2.1.4
的devDependencies需要angular 5:
"devDependencies": {
- "@angular/common": "2.4.8",
- "@angular/compiler": "^2.4.8",
- "@angular/compiler-cli": "^2.4.8",
- "@angular/core": "2.4.8",
- "@angular/platform-browser": "2.4.8",
- "@angular/platform-browser-dynamic": "2.4.8",
- "@angular/router": "3.4.8",
- "@types/node": "^7.0.5",
+ "@angular/common": ">=5.0.0",
+ "@angular/compiler": ">=5.0.0",
+ "@angular/compiler-cli": ">=5.0.0",
+ "@angular/core": ">=5.0.0",
+ "@angular/platform-browser": ">=5.0.0",
+ "@angular/platform-browser-dynamic": ">=5.0.0",
+ "@angular/router": ">=5.0.0",
+ "@types/node": ">=7.0.5",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rollup": "^0.41.4",
"rxjs": "5.1.1",
"tslint": "^4.4.2",
- "typescript": "^2.1.6",
+ "typescript": "~2.4.2",
"uglify-js": "^2.7.5",
"zone.js": "^0.7.7"
},