我正在从事Angular2项目。该项目正在我正在使用的其他系统上工作,但是以某种方式我必须在其他系统中切换我的项目。当我在另一个系统中使用相同的配置(如npm,cli)设置相同的项目并运行该程序时,它不起作用并给出错误。我已经卸载了cli,清除了缓存并重新安装了cli,但无法正常工作。请告知。请参阅随附的错误图片。
请参考错误:模块/node_modules/@agm/core/index.d.ts的元数据版本不匹配,发现版本4,预期为3,在/src/app/app.module.ts中解析符号AppModule ,在src / app / app.module.ts中解析符号AppModule,在D:/Saumil/Lakonia/lcgoopcomanuel1lp/src/app/app.module.ts中解析符号AppModule
这是我的package.json
{
"name": "well-application",
"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": {
"@agm/core": "^1.0.0-beta.1",
"@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",
"@types/videojs": "^5.16.2",
"@types/xlsx": "0.0.35",
"bootstrap": "^3.3.7",
"chart.js": "^2.7.2",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"fractional": "^1.0.0",
"javascript-to-typescript": "^1.0.2",
"ng2-accordion": "0.0.15",
"ng2-charts": "^1.6.0",
"ng2-currency-mask": "^5.3.1",
"ng2-ion-range-slider": "^1.0.3",
"ngx-bootstrap": "^2.0.0-rc.0",
"ngx-slick": "^0.1.3",
"rxjs": "^5.4.2",
"ts-xlsx": "0.0.11",
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular/cli": "1.3.2",
"@angular/compiler-cli": "^4.2.4",
"@angular/language-service": "^4.2.4",
"@types/core-js": "^0.9.43",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "~3.1.1",
"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.3.2",
"typescript": "~2.3.3"
}
}
答案 0 :(得分:0)
您发布的图像不清楚。但似乎该错误与节点模块版本(特别是agm软件包)中的不匹配有关。
我认为,通过删除项目中的 node_modules 目录,然后运行npm install
,它将安装正确版本的软件包。试试吧。
答案 1 :(得分:0)
我已经通过myslef解决了此问题,方法是从“ @ agm / core”中删除“ ^”:“ ^ 1.0.0-beta.1”,它的工作原理是因为当我使用“ ^ 1.0.0-beta.1”时”,则它需要较高的版本“ 1.0.0-beta.3”,并且无法正常工作–