angular-cli: Can't resolve 'crossfilter' in '~node_modules\dc'

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request


@angular/cli: 1.0.3 node: 6.10.3 os: win32 x64 @angular/common: 4.1.2 @angular/compiler: 4.1.2 @angular/core: 4.1.2 @angular/forms: 4.1.2 @angular/http: 4.1.2 @angular/platform-browser: 4.1.2 @angular/platform-browser-dynamic: 4.1.2 @angular/router: 4.1.2 @angular/cli: 1.0.3 @angular/compiler-cli: 4.1.2

Repro steps.

ng new testproj && cd testproj npm install --save dc

replace app.component.ts with

import { Component } from '@angular/core';
import * as crossfilter from 'crossfilter2';
import * as d3 from 'd3';
import * as dc from 'dc';

  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
export class AppComponent {
  title = 'app works!';

    constructor() {
    setupCharts() {
        const chart = dc.barChart('#test');

The log given by the failure.

ERROR in ./~/dc/dc.js
Module not found: Error: Can't resolve 'crossfilter' in 'C:\Users\akibler\Documents\Visual Studio 2017\Projects\testproj\node_modules\dc'
 @ ./~/dc/dc.js 10707:8-42
 @ ./src/app/app.component.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi ./src/main.ts

Desired functionality.

Let me use DC?

Mention any other details that might be useful.

This issue with dc.js makes it seem like we need to be able to add a “resolve” to the webpack config. I’m not sure that this is possible with .angular-cli.json

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Untested but something like the following should work on Linux/MacOS (not sure of the equivalent for Windows):

"postinstall": "if [ -e node_modules/crossfilter2 ]; then mv node_modules/crossfilter2 node_modules/crossfilter; fi"