Npm:已安装包装的UNMET PEER DEPENDENCY

时间:2017-12-20 08:10:28

标签: typescript npm

为什么我得到一个:

+-- UNMET PEER DEPENDENCY typescript@2.6.2

什么时候安装了typescript@2.6.2?

> tsc -v
Version 2.6.2

我已在全球范围内安装typescript

修改

packages.json

"dependencies": {
    "@angular/animations": "~5.1.0",
    "@angular/common": "~5.1.0",
    "@angular/compiler": "~5.1.0",
    "@angular/core": "~5.1.0",
    "@angular/forms": "~5.1.0",
    "@angular/platform-browser": "~5.1.0",
    "@angular/platform-browser-dynamic": "~5.1.0",
    "@angular/platform-server": "~5.1.0",
    "@angular/router": "~5.1.0",
    "core-js": "^2.5.1",
    "http-server": "^0.10.0",
    "ie-shim": "^0.1.0",
    "reflect-metadata": "^0.1.10",
    "rxjs": "^5.5.2",
    "ts-odatajs": "^4.0.2",
    "zone.js": "~0.8.18"
  },
  "devDependencies": {
    "@angular-devkit/build-optimizer": "^0.0.32",
    "@angular/compiler-cli": "~5.1.1",
    "@compodoc/compodoc": "^1.0.0-beta.15",
    "@ngtools/webpack": "^1.8.0",
    "@types/hammerjs": "^2.0.34",
    "@types/jasmine": "2.5.45",
    "@types/node": "^7.0.39",
    "@types/source-map": "^0.5.0",
    "@types/uglify-js": "^2.6.28",
    "@types/webpack": "^2.2.16",
    "add-asset-html-webpack-plugin": "^1.0.2",
    "angular2-template-loader": "^0.6.2",
    "assets-webpack-plugin": "^3.5.1",
    "awesome-typescript-loader": "^3.3.0",
    "codelyzer": "~2.1.1",
    "copy-webpack-plugin": "^4.0.1",
    "cross-env": "^5.0.0",
    "css-loader": "^0.28.0",
    "exports-loader": "^0.6.4",
    "expose-loader": "^0.7.3",
    "extract-text-webpack-plugin": "~3.0.0",
    "file-loader": "^0.11.1",
    "find-root": "^1.0.0",
    "gh-pages": "^1.0.0",
    "html-webpack-plugin": "^2.28.0",
    "imports-loader": "^0.7.1",
    "inline-manifest-webpack-plugin": "^3.0.1",
    "istanbul-instrumenter-loader": "2.0.0",
    "jasmine-core": "^2.5.2",
    "karma": "^1.6.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-coverage": "^1.1.1",
    "karma-jasmine": "^1.1.0",
    "karma-mocha-reporter": "^2.2.3",
    "karma-remap-coverage": "^0.1.4",
    "karma-sourcemap-loader": "^0.3.7",
    "karma-webpack": "^2.0.4",
    "ngc-webpack": "^4.0.2",
    "node-sass": "^4.5.2",
    "npm-run-all": "^4.0.2",
    "optimize-js-plugin": "0.0.4",
    "parse5": "^3.0.2",
    "preload-webpack-plugin": "^1.2.2",
    "protractor": "^5.1.1",
    "raw-loader": "0.5.1",
    "rimraf": "~2.6.1",
    "sass-loader": "^6.0.3",
    "script-ext-html-webpack-plugin": "^1.8.5",
    "source-map-loader": "^0.2.1",
    "string-replace-loader": "~1.3.0",
    "style-loader": "^0.18.1",
    "to-string-loader": "^1.1.5",
    "ts-node": "^3.3.0",
    "tslib": "^1.7.1",
    "tslint": "~4.5.1",
    "tslint-loader": "^3.5.2",
    "typedoc": "^0.7.1",
    "typescript": "~2.6.2",
    "uglifyjs-webpack-plugin": "^1.0.1",
    "url-loader": "^0.5.8",
    "webpack": "^3.8.1",
    "webpack-dev-middleware": "^1.10.1",
    "webpack-dev-server": "~2.7.1",
    "webpack-dll-bundles-plugin": "^1.0.0-beta.5",
    "webpack-merge": "~4.1.0"
  },

1 个答案:

答案 0 :(得分:0)

在我的Angular项目中,我目前正在使用"@angular/xxx": "~5.0.0""typescript": "~2.4.0",但我没有收到此警告消息。

我在5.1.1中看到Angular团队仍然使用"typescript": "2.5.X"link),这可能是导致您出现问题的原因。

当我在过去收到此类警告时,对我有用的是删除package-lock.jsonnode_modules并重新安装依赖项。