question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Having build errors after upgrading to v 0.5.5 (from 0.4.1) ...

See original GitHub issue

Please feel free to remove this if you don’t think its appropriate but I’m posting this here in case other people run into the same issue. I want to make sure I am doing the right thing, it seems like I shouldn’t be doing this but it works. Or maybe, the documentation should be updated in case other people run into the same thing.

After upgrading to 0.5.5 (from 0.4.1) I made the changes to the module file that was in the documentation. NOTE: In my case, I have the angular2-highcharts module included in a module that is NOT the app module so maybe this is why it didn’t work for me.

The changes I made to my module file was the following (as recommended in the release notes for v0.5.4):

@NgModule({
  imports: [
    CommonModule,
    ChartModule.forRoot(require('highcharts'))
  ],

When I build (note: I am using the very latest angular-cli beta 32) I get the following error:

ERROR in Error encountered resolving symbol values statically. Calling function 'ChartModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol TngoCommonModule in /Users/emcpadden/Tangoe/Code/analytics/tangoe-analytics/src/app/tngo-common/tngo-common.module.ts, resolving symbol TngoCommonModule in /Users/emcpadden/Tangoe/Code/analytics/tangoe-analytics/src/app/tngo-common/tngo-common.module.ts

In looking at some of the issues, I saw something that looked like it might work, although I’m not sure I get why. But when I change the module file to the following, I was able to get everything to work:

import { ChartModule } from 'angular2-highcharts';
import { HighchartsStatic } from 'angular2-highcharts/dist/HighchartsService';
export function highchartsFactory() {
  return require('highcharts');
}

@NgModule({
  imports: [
    ChartModule
  ],
  providers: [
    {
      provide: HighchartsStatic,
      useFactory: highchartsFactory
    }
  ],

Is this something I should be doing? It does work but I just want to make sure there isn’t some other more accepted solution.

Thanks!

P.S. THANK YOU @gevgeny for creating this library! I do really appreciate this library THANK YOU for all the work you did on this.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:11
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
Gsmalhotra1commented, May 18, 2017

Check my App module code , this may help you

import { BrowserModule } from '@angular/platform-browser';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MaterialModule } from '@angular/material';
import 'hammerjs';
import { ChartModule } from 'angular2-highcharts';
import * as highcharts from 'highcharts';
import { HighchartsStatic } from 'angular2-highcharts/dist/HighchartsService';

import { AppRouting } from './app.routing';
import { AppComponent } from './app.component';

declare var require: any;


export function highchartsFactory() {
      const hc = require('highcharts');
      const dd = require('highcharts/modules/drilldown');
      dd(hc);

      return hc;
}

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    AppRouting,
    BrowserAnimationsModule,
    MaterialModule,
    ChartModule
  ],
  providers: [{
      provide: HighchartsStatic,
      useFactory: highchartsFactory
    }],
  bootstrap: [AppComponent]
})
export class AppModule { }

1reaction
nategthomascommented, Jul 27, 2017

You can use highstock with the method shown by Gsmalhotra1 by importing it like this:

import * as stock from “highcharts/modules/stock”;

Read more comments on GitHub >

github_iconTop Results From Across the Web

NPM install fails, OSX - node gyp - Stack Overflow
I have tried upgrading and downgrading node , clearing the cache. Deleting and re-setting up node_modules , but the error always remains the ......
Read more >
Meaning of common message when install a package "There ...
When installing packages, the message There are binary versions available but the source versions are later often appears. This is (I think) followed...
Read more >
solidity - Source File requires different compiler version
The error implies the installed Solidity compiler is version which is trying to compile your solidity code is v0.5.0. So the question I...
Read more >
Changelog — prospector documentation
A new flag, -0 or –zero-exit , turns off this behaviour so that a non-zero exit code indicates that prospector failed to run....
Read more >
Compilation failed (return status=1)... error after installing ...
I am also having compilation issues on a first-time install on MacOS. I'm on an M1 Mac running Monterey. Followed instructions here and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found