INDEPENDENT DEPENDENCE OF CHILDREN D3.js and Angular 2

I have an existing Angular 2 project and am trying to start integrating some D3.js into my project. I am new to Angular and this will be my first step when using D3. I will follow this guide: https://keathmilligan.net/create-reusable-chart-components-with-angular-2-and-d3-js-version-4/

I run the npm install --save d3 and I get:

 β”œβ”€β”€ UNMET PEER DEPENDENCY @angular/ compiler@2.2.3 β”œβ”€β”€ UNMET PEER DEPENDENCY @angular/ compiler-cli@2.2.3 β”œβ”€β”€ UNMET PEER DEPENDENCY @angular/ core@2.2.3 └── d3@4.4.1 

... then

 npm WARN @ngtools/ webpack@1.2.1 requires a peer of @angular/ compiler@ ^2.3.1 but none was installed. npm WARN @ngtools/ webpack@1.2.1 requires a peer of @angular/ compiler-cli@ ^2.3.1 but none was installed. npm WARN @ngtools/ webpack@1.2.1 requires a peer of @angular/ core@ ^2.3.1 but none was installed. npm WARN @ngtools/ webpack@1.2.1 requires a peer of @angular/ tsc-wrapped@ ^0.5.0 but none was installed. npm WARN tslint-loader@2.1.5 requires a peer of tslint@ ^3.0.0 but none was installed. 

Firstly, I think I still don’t quite understand what it means when I see "UNMET PEER DEPENDENCY" . Is this just a warning, or does it indicate that something is really broken? My project is currently working (but I haven't started coding with D3 yet) ... Is the wrong version of something just installed? I followed all the steps to update everything through npm update --save , and NPM found some updates for me, but I still have the same problem.

My main question though, I am installing D3js, shouldn't it be completely independent of Angular? Why does NPM bark about Angular things when I install something unrelated?

Here is my post about updating package.json:

  "name": "cl-test2", "version": "0.0.0", "license": "MIT", "angular-cli": {}, "scripts": { "start": "ng serve", "lint": "tslint \"src/**/*.ts\"", "test": "ng test", "pree2e": "webdriver-manager update", "e2e": "protractor" }, "private": true, "dependencies": { "@angular/common": "2.2.3", "@angular/compiler": "2.2.3", "@angular/core": "^2.2.3", "@angular/forms": "2.2.3", "@angular/http": "2.2.3", "@angular/platform-browser": "2.2.3", "@angular/platform-browser-dynamic": "2.2.3", "@angular/router": "3.2.3", "@types/node": "^6.0.58", "angular-cli": "^1.0.0-beta.22-1", "core-js": "^2.4.1", "d3": "^4.4.1", "rxjs": "5.0.0-beta.12", "ts-helpers": "^1.1.1", "tslint": "^4.3.1", "zone.js": "^0.6.23" }, "devDependencies": { "@angular/compiler-cli": "2.2.3", "@types/jasmine": "2.5.38", "@types/node": "^6.0.42", "angular-cli": "^1.0.0-beta.24", "codelyzer": "~2.0.0-beta.1", "jasmine-core": "2.5.2", "jasmine-spec-reporter": "2.5.0", "karma": "1.2.0", "karma-chrome-launcher": "^2.0.0", "karma-cli": "^1.0.1", "karma-jasmine": "^1.0.2", "karma-remap-istanbul": "^0.2.1", "protractor": "4.0.9", "ts-node": "1.2.1", "tslint": "^4.0.2", "typescript": "~2.0.3", "webdriver-manager": "10.2.5" } } 
+5
source share
3 answers

UNMET PEER DEPENDENCY Logs are just warnings, not errors.

They warn you that the lib you use @ngtools/ webpack@1.2.1 should use @angular/ compiler@ ^2.3.1 (more on ^ fooobar.com/questions/631 / ... ) as I sure you understand yourself.

The author of these libraries may have some deprecated APIs and may not support the current code in later versions, which is one of the reasons you should update your dependencies.

+2
source

This does not answer all the questions that I had, but it eliminates the warnings I received. I just updated several packages to the latest versions.

 { "name": "cl-test2", "version": "0.0.0", "license": "MIT", "angular-cli": {}, "scripts": { "start": "ng serve", "lint": "tslint \"src/**/*.ts\"", "test": "ng test", "pree2e": "webdriver-manager update", "e2e": "protractor" }, "private": true, "dependencies": { "@angular/common": "^2.4.2", "@angular/compiler": "^2.4.2", "@angular/core": "^2.4.2", "@angular/forms": "^2.4.2", "@angular/http": "^2.4.2", "@angular/platform-browser": "^2.4.2", "@angular/platform-browser-dynamic": "^2.4.2", "@angular/router": "^3.4.2", "core-js": "^2.4.1", "d3": "^4.4.1", "rxjs": "^5.0.1", "ts-helpers": "^1.1.2", "types.d3": "^0.1.1", "zone.js": "^0.7.2" }, "devDependencies": { "@angular/compiler-cli": "2.4.2", "@types/jasmine": "2.5.38", "@types/node": "^6.0.42", "angular-cli": "^1.0.0-beta.24", "codelyzer": "~2.0.0-beta.1", "jasmine-core": "2.5.2", "jasmine-spec-reporter": "2.5.0", "karma": "1.2.0", "karma-chrome-launcher": "^2.0.0", "karma-cli": "^1.0.1", "karma-jasmine": "^1.0.2", "karma-remap-istanbul": "^0.2.1", "protractor": "4.0.13", "ts-node": "1.2.1", "tslint": "^4.0.2", "typescript": "~2.1.4", "webdriver-manager": "10.2.5" } } 
0
source

I also had a similar problem, I followed the steps

Npm install -g @ angular / cli first

create a new project with ng new hero-app

After going to the project folder and starting the ng serve server

and open a browser and run http: // localhost: 4200

This is a job for me. Hope the same for you.

0
source

Source: https://habr.com/ru/post/1262452/


All Articles