Angular-tree-component: Error TypeError: (void 0) is not a function (using SystemJS and latest version)

Created on 9 May 2017  路  9Comments  路  Source: CirclonGroup/angular-tree-component

ERROR Error: Uncaught (in promise): TypeError: (void 0) is not a function
TypeError: (void 0) is not a function
at new e (tree-options.model.js:43)
at new e (tree.model.js:19)
at createClass (provider.ts:369)
at _createProviderInstance (provider.ts:336)
at createProviderInstance (provider.ts:145)
at createViewNodes (view.ts:281)
at callViewAction (view.ts:705)
at execComponentViewsAction (view.ts:649)
at createViewNodes (view.ts:356)
at createEmbeddedView (view.ts:209)
at callWithDebugContext (services.ts:647)
at Object.debugCreateEmbeddedView [as createEmbeddedView] (services.ts:210)
at TemplateRef_.createEmbeddedView (refs.ts:522)
at ViewContainerRef_.createEmbeddedView (refs.ts:277)
at NgTemplateOutlet.ngOnChanges (ng_template_outlet.ts:43)
at new e (tree-options.model.js:43)
at new e (tree.model.js:19)
at createClass (provider.ts:369)
at _createProviderInstance (provider.ts:336)
at createProviderInstance (provider.ts:145)
at createViewNodes (view.ts:281)
at callViewAction (view.ts:705)
at execComponentViewsAction (view.ts:649)
at createViewNodes (view.ts:356)
at createEmbeddedView (view.ts:209)
at callWithDebugContext (services.ts:647)
at Object.debugCreateEmbeddedView [as createEmbeddedView] (services.ts:210)
at TemplateRef_.createEmbeddedView (refs.ts:522)
at ViewContainerRef_.createEmbeddedView (refs.ts:277)
at NgTemplateOutlet.ngOnChanges (ng_template_outlet.ts:43)
at resolvePromise (zone.js:712) [angular]
at resolvePromise (zone.js:683) [angular]
at :52688/node_modules/zone.js/dist/zone.js:760:17 [angular]
at Object.onInvokeTask (ng_zone.ts:254) [angular]
at ZoneDelegate.invokeTask (zone.js:397) [angular]
at Zone.runTask (zone.js:165) [ => angular]
at drainMicroTaskQueue (zone.js:593) []
at ZoneTask.invoke (zone.js:464) []
at timer (zone.js:1540) []

SystemJS

Most helpful comment

Hey guys, unfortunately we stopped supporting SystemJS.
I recommend users to switch to Webpack or the standard Angular CLI (which uses Webpack).

All the best

All 9 comments

Same error. Are you using commonjs as module in your tsconfig.js?

same error, and same error info.

After I run ./node_modules/.bin/ngc, I found this in file dist/modles/tree-options.model.js

   import * as _ from 'lodash';
   /** ... **/
   this.actionMapping = _.defaultsDeep({}, this.options.actionMapping, defaultActionMapping);

But when I finished npm run rollup, in file dist/angular-tree-component.umd.js

   this.actionMapping = (void 0)({}, this.options.actionMapping, F);

Is there any wrongs when rollup?

So I add lodash to external in rollup.config.js, like this

  external: [
    '@angular/core',
    '@angular/common',
    'lodash'
  ]

It resolve this TypeError

I found this error started from https://github.com/500tech/angular-tree-component/commit/614a3ffcd42ae495912944f42375751017265c8f#diff-a49e088cfd190025a0641f4d1fff986e

thanks thesadabc, working after adding lodash to rollup.config.js :)

I fix my issue downgrading to 3.2.3. These are my dependencies:

 "@angular/common": "4.0.0",
    "@angular/compiler": "4.0.0",
    "@angular/core": "4.0.0",
    "@angular/forms": "4.0.0",
    "@angular/http": "4.0.0",
    "@angular/platform-browser": "4.0.0",
    "@angular/platform-browser-dynamic": "4.0.0",
    "@angular/router": "4.1.1",
    "@angular/upgrade": "4.0.0",
    "angular-in-memory-web-api": "~0.1.15",
    "angular-tree-component": "3.2.3",

I have the same problem and downgrade to 3.2.3 fix it. Thanks for this advice @elcondedebahia

In my case , it is fixed by downgrading to version 3.4.0.

Hey guys, unfortunately we stopped supporting SystemJS.
I recommend users to switch to Webpack or the standard Angular CLI (which uses Webpack).

All the best

Maybe you can try to use void(0)

image

Was this page helpful?
0 / 5 - 0 ratings