过去几天我一直在努力解决软件包依赖问题,我的目标是使用angular2-busy但我开始阅读它并且我认为我有更大的整体问题。
当我运行“npm list
”时,我收到了一堆UNMET PEER DEPENDENCY消息。
我想开始清理它,第一个条目是:
"UNMET PEER DEPENDENCY @angular/common@2.4.9"
我尝试重新安装@ angular / common但是没有任何区别,有人可以向我解释这里的实际问题是什么,所以我可以开始清理所有这些了吗?
感谢。
{
"name": "angular-quickstart",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented with testing support",
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
"lint": "tslint ./app/**/*.ts -t verbose",
"lite": "lite-server",
"pree2e": "webdriver-manager update",
"test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
"test-once": "tsc && karma start karma.conf.js --single-run",
"tsc": "tsc",
"tsc:w": "tsc -w"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@angular/common": "~2.4.4",
"@angular/compiler": "~2.4.4",
"@angular/core": "~2.4.4",
"@angular/forms": "~2.4.4",
"@angular/http": "~2.4.4",
"@angular/platform-browser": "~2.4.4",
"@angular/platform-browser-dynamic": "~2.4.4",
"@angular/router": "~3.4.4",
"angular-in-memory-web-api": "~0.2.2",
"angular2-busy": "^1.0.2",
"angular2-datatable": "^0.5.2",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"lodash": "^4.17.4",
"ng2-filter-pipe": "^0.1.6",
"ng2-toasty": "^2.3.0",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.1",
"systemjs": "0.19.40",
"zone.js": "^0.7.6"
},
"devDependencies": {
"@types/jasmine": "2.5.36",
"@types/lodash": "ts2.0",
"@types/node": "^7.0.4",
"canonical-path": "0.0.2",
"concurrently": "^3.1.0",
"gulp": "^3.9.1",
"http-server": "^0.9.0",
"jasmine-core": "~2.4.1",
"karma": "^1.4.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"lite-server": "^2.2.2",
"lodash": "^4.16.4",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"tslint": "^3.15.1",
"typescript": "~2.0.10"
},
"repository": {}
}
答案 0 :(得分:2)
你要做的所有事情都是冷杉吗?
npm list
用于列出已安装的软件包,它不会安装/更新任何内容。
您应该npm install
或npm update
我已经复制了你的package.json并执行了这些命令行:
npm cache clean
npm install
npm update
一切正常!
要检查依赖项版本,请尝试使用npm-check-updates
要安装,请使用此命令:
npm install -g npm-check-updates
从命令行安装后运行ncu
,您将看到最新版本的软件包。
关于npm版本号的另一件事,请查看本文Node and npm Version Numbering: Guide and Best Practices
更新到最新版本后,您的package.json
如下所示:
{
"name": "angular-quickstart",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented with testing support",
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
"lint": "tslint ./app/**/*.ts -t verbose",
"lite": "lite-server",
"pree2e": "webdriver-manager update",
"test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
"test-once": "tsc && karma start karma.conf.js --single-run",
"tsc": "tsc",
"tsc:w": "tsc -w"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@angular/common": "~2.4.4",
"@angular/compiler": "~2.4.4",
"@angular/core": "~2.4.4",
"@angular/forms": "~2.4.4",
"@angular/http": "~2.4.4",
"@angular/platform-browser": "~2.4.4",
"@angular/platform-browser-dynamic": "~2.4.4",
"@angular/router": "~3.4.4",
"angular-in-memory-web-api": "~0.3.1",
"angular2-busy": "^1.0.2",
"angular2-datatable": "^0.5.2",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"lodash": "^4.17.4",
"ng2-filter-pipe": "^0.1.6",
"ng2-toasty": "^2.3.0",
"reflect-metadata": "^0.1.8",
"rxjs": "5.2.0",
"systemjs": "0.20.9",
"zone.js": "^0.8.0"
},
"devDependencies": {
"@types/jasmine": "2.5.45",
"@types/lodash": "ts2.0",
"@types/node": "^7.0.4",
"canonical-path": "0.0.2",
"concurrently": "^3.1.0",
"gulp": "^3.9.1",
"http-server": "^0.9.0",
"jasmine-core": "~2.5.2",
"karma": "^1.4.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"lite-server": "^2.2.2",
"lodash": "^4.16.4",
"protractor": "~5.1.1",
"rimraf": "^2.5.4",
"tslint": "^4.5.1",
"typescript": "~2.2.1"
},
"repository": {}
}