Use npm to install from the project folder,
$ npm install d3 --save
$ npm install --save @types/d3
In the component file, app.component.ts
I posted about this before but this is a more straight-forward way to do this.