gevgeny / angular2-highcharts

:bar_chart: :chart_with_upwards_trend: Highcharts for your Angular project
MIT License
380 stars 113 forks source link

Cannot resolve module 'highcharts/highcharts-more' at the build (Gulp build) #96

Open maxaster opened 7 years ago

maxaster commented 7 years ago

Hi guys,

I have an issue at the compilation when i launch gulp build which is :

modulesModuleNotFoundError: Module not found: Error: Cannot resolve module 'highcharts/highcharts-more'
......
resolve module highcharts/highcharts-more in ..... node_modules/highcharts doesn't exist (module as directory)

However, i can see that angular2-highcharts is installed during the npm install (with Highcharts module)

For information i use Webpack. My vendor.js have these lines :

import 'highcharts';
import 'highcharts/highcharts-more';
import 'highcharts/modules/solid-gauge';
import 'highcharts/modules/map';

And in my .ts file i have :

import { Highcharts} from 'angular2-highcharts';

require('highcharts/highcharts-more')(Highcharts);
require('highcharts/modules/solid-gauge')(Highcharts)

I use Jenkins by the way. In my local environment the build works, but in the distant server the error occurs.

And i have no errors in my console when i run the app locally

Thanks !!

Sfairet commented 7 years ago

@maxaster after update to angular2-highcharts@0.4.1 to use highcharts-more you must import it like this:

const Highcharts = require('highcharts');
require('highcharts/highcharts-more')(Highcharts);

And i use SystemJs, to work import i change import 'highcharts' toimport 'highcharts/highcharts.src.js' (for highcharts@5.0.2). But i dont know how it must on Webpack.

gevgeny commented 7 years ago

@maxaster I added webpack example for 0.4.1 https://github.com/gevgeny/angular2-highcharts#installation

gevgeny commented 7 years ago

Let me know if it works for you

maxaster commented 7 years ago

Thanks @Sfairet and @gevgeny for your responses !

@Sfairet, I tried your proposition but it's change nothing for me.

@gevgeny, I 'm trying your version but I can't make this import :

import * as HighchartsMore from 'highcharts/highcharts-more';

Webstorm tell me that the file 'highcharts-more' can not be resolved.

I check in the folder _nodemodule/@types/highcharts/ and there is only highstock.d.ts.

There is one thing that I don't understand. How my build can be work locally, on my computer, and no on my distant server... very strange. Sorry guys but this error make me so mad

Sfairet commented 7 years ago

@maxaster ok, sorry, i haven't experience with webpack

gevgeny commented 7 years ago

@maxaster ignore what webstorm says. What does webpack say ?

oitejjho commented 6 years ago

go to project directory and run "npm install highcharts"