angular2-highcharts icon indicating copy to clipboard operation
angular2-highcharts copied to clipboard

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

Open maxaster opened this issue 9 years ago • 7 comments

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 !!

maxaster avatar Oct 28 '16 12:10 maxaster

@maxaster after update to [email protected] 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 [email protected]). But i dont know how it must on Webpack.

Sfairet avatar Oct 31 '16 07:10 Sfairet

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

gevgeny avatar Oct 31 '16 08:10 gevgeny

Let me know if it works for you

gevgeny avatar Oct 31 '16 08:10 gevgeny

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 node_module/@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

maxaster avatar Oct 31 '16 08:10 maxaster

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

Sfairet avatar Oct 31 '16 08:10 Sfairet

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

gevgeny avatar Oct 31 '16 08:10 gevgeny

go to project directory and run "npm install highcharts"

oitejjho avatar Oct 23 '17 09:10 oitejjho