【问题标题】:Project set up not woring项目设置不起作用
【发布时间】:2018-09-08 20:05:17
【问题描述】:

我正在开发 Angular2 项目。该项目正在我正在工作的另一个系统中运行,但不知何故我必须在其他系统中切换我的项目。当我在另一个系统中设置具有相同配置的相同项目时,在另一个系统中运行 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"
  }
}

【问题讨论】:

  • 您能否编辑您的问题,并粘贴到 package.json 文件的内容中?
  • 请在此处复制您发布的图片中的完整错误日志
  • 模块 /node_modules/@agm/core/index.d.ts 元数据版本不匹配出现错误,找到版本 4,预期为 3,解析 /src/app/app.module.ts 中的符号 AppModule ,解析src/app/app.module.ts中的符号AppModule,解析src/app/app.module.ts中的符号AppModule
  • 你能把 package.json 贴在这里吗?
  • @saumil_jariwala 请随后发布您的package.json

标签: angular


【解决方案1】:

您发布的图片不清晰。但似乎该错误与节点模块版本(特别是 agm 包)不匹配有关。

我认为通过删除项目中的 node_modules 目录,然后运行 ​​npm install 它将安装正确版本的软件包。试试看。

【讨论】:

  • 您是否尝试删除 package-lock.json 并重试?
  • 是的,我删除了 package-lock.json,删除了节点模块并使用命令 npm install 但仍然出现错误
【解决方案2】:

我已经通过 myslef 从“@agm/core”中删除“^”来解决它:“^1.0.0-beta.1”,它可以工作,因为当我使用“^1.0.0-beta.1”时",然后它需要更高版本的 "1.0.0-beta.3" 并且它不工作 -

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-12-14
    • 1970-01-01
    • 1970-01-01
    • 2019-02-25
    • 2014-04-19
    • 1970-01-01
    • 2010-11-23
    相关资源
    最近更新 更多