我正在尝试构建一个其他人创建的项目,但遇到了未满足的依赖问题。
NPM install命令抱怨ngx-webstorage需要angular 5.0.0,而我确实没有安装5.0.0,因为项目的其余部分还不能使用它。
我全局安装了node版本6.12,并安装了angular CLI版本3.10
$ which npm
/usr/bin/npm
$ npm --version
3.10.10
$ which ng
/usr/bin/ng
$ ng --version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.6.2
Node: 6.12.0
OS: linux x64
Angular:
...
我使用全局安装的npm来安装依赖项,然后看到“需要一个对等体”消息。
$ npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN ngx-webstorage@2.0.1 requires a peer of @angular/core@^5.0.0 but none was installed.
npm WARN ng2-pop-over@0.9.37 requires a peer of @angular/core@^2.4.0 but none was installed.
npm WARN ng2-pop-over@0.9.37 requires a peer of zone.js@^0.7.2 but none was installed.
npm WARN ng2-accordion@0.0.15 requires a peer of @angular/core@^2.0.0 but none was installed.
npm WARN @schematics/angular@0.0.49 requires a peer of @angular-devkit/schematics@0.0.34 but none was installed.
这是package.json
{
"name": "perkin-elmer",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"prestart": "npm install",
"start": "ng serve --proxy-config proxy.config.json",
"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",
"@types/underscore": "^1.8.6",
"ag-grid": "^13.3.1",
"ag-grid-angular": "^13.3.0",
"angular-2-dropdown-multiselect": "^1.6.3",
"angular2-multiselect-checkbox-dropdown": "^1.5.0",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"jquery": "^2.2.4",
"lodash": "^4.17.4",
"ng-dynamic-component": "^1.1.0",
"ng2-accordion": "0.0.15",
"ng2-bootstrap-modal": "^1.0.1",
"ng2-pop-over": "^0.9.37",
"ngx-treeview": "^1.2.5",
"ngx-webstorage": "^2.0.1",
"rxjs": "^5.4.2",
"underscore": "^1.8.3",
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular/cli": "1.4.5",
"@angular/compiler-cli": "^4.2.4",
"@angular/language-service": "^4.2.4",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/lodash": "^4.14.91",
"@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"
}
}
由于我没有开发这个包,我不确定为什么ngx-webstorage被设置为需要2.0.1版,而2.0.1版需要angular 5.0.0,因为这显然不符合其余的angular版本要求,因为在所有情况下这些版本仍然是4。
我在npm站点上查看了ngx-webstorage 2.0.1的要求,实际上devDependencies是5.0.0,但是这个package.json怎么可能工作呢?我知道它是有效的,因为这个应用是在其他网站上运行的。
任何帮助都是非常感谢的。
发布于 2018-10-19 17:12:20
从表面上看,ngx-webstorage
被抛弃了。(请参阅:https://github.com/PillowPillow/ng2-webstorage/pull/91)
使用ngx-webstorage
的Angular 6兼容分支:https://www.npmjs.com/package/@rars/ngx-webstorage/v/3.0.0
npm install @rars/ngx-webstorage --save
https://stackoverflow.com/questions/48030171
复制