AngularJS + Webpack Mysterious Bug - Cannot read property 'call' of undefined - javascript

I'm working on a project using AngularJS with Webpack, I'm getting a very weird bug:
Sometimes an error will show up:
TypeError: Cannot read property 'call' of undefined
at __webpack_require__ (vendor.js:51)
at Object.357 (templates.js:377)
at __webpack_require__ (vendor.js:51)
at exam (app.js:17755)
at Object.invoke (vendor.js:21978)
at vendor.js:24895
at forEach (vendor.js:17592)
at Object.<anonymous> (vendor.js:24893)
at Object.invoke (vendor.js:21978)
at Object.enforcedReturnValue [as $get] (vendor.js:21817)(anonymous function) # vendor.js:30912
The weird part: When i comment out the recently changed piece of code, and re-insert it (such that the code is the same), it suddenly works for a little while, then the same error appears !
I don't have the slightest clue as to what's causing this, Any help will be greatly appreciated.

Related

NextJS + Apollo + i18n - unexpected error

The client I am working with at the moment has requested I build a SSR React app which includes i18n. To solve this problem I tried to use NextJS and i18Next.
I managed to get react and apollo linked up without issue but when I tried to connect next + i18n I keep getting a very unhelpful 'an unexpected error' occured, error.
Inspecting the console I also see the following:
Cannot read property 'prototype' of undefined
TypeError: Cannot read property 'prototype' of undefined
at Object.inherits (http://localhost:3000/_next/1515592576452/page/index.js:36080:46)
at Object.<anonymous> (http://localhost:3000/_next/1515592576452/page/index.js:30216:6)
at Object.<anonymous> (http://localhost:3000/_next/1515592576452/page/index.js:30440:30)
at __webpack_require__ (http://localhost:3000/_next/1515592576452/manifest.js:714:31)
at fn (http://localhost:3000/_next/1515592576452/manifest.js:117:20)
at Object.<anonymous> (http://localhost:3000/_next/1515592576452/page/index.js:28246:12)
at Object.module.exports.exports.byteLength (http://localhost:3000/_next/1515592576452/page/index.js:28507:30)
at __webpack_require__ (http://localhost:3000/_next/1515592576452/manifest.js:714:31)
at fn (http://localhost:3000/_next/1515592576452/manifest.js:117:20)
at Object.<anonymous> (http://localhost:3000/_next/1515592576452/page/index.js:24501:18)
Also this warning but i'm not sure it's related
warning.js?e7f4ca8:33 Warning: Expected server HTML to contain a matching <div> in <div>.
I've also noticed that in ./libs/withData.js there is the following line:
enter code herestatic displayName = WithData(${getComponentDisplayName(
ComposedComponent
)})
My editor flags that as an invalid token but this code came from the nextjs example and there is no issue on that repo which suggests it's a typo.
I've included all the code that pertains to this issue in the following codepen project.
https://codepen.io/foxleigh81/project/editor/DnYJWB
OK I've sort of worked it out.
In a nutshell. I was thinking about this all wrong. I was thinking I was adding next to my react app, whereas the reality is more like I'm putting my react app inside next. I took it apart and rebuilt it from scratch, assembling the examples on the nextjs repo and it all worked.

Meteor.js app running locally throwing TypeError: Cannot read property 'appId' of undefined

Brand new to meteor, have only ever used rails. A friend gave me her app to mess around with. When I run meteor run in the console, and load localhost I get the following error message in the browser. I am finding I cant understand the error message. Could someone please assist me in understanding it?
/Users/mainuser/.meteor/packages/meteor-tool/.1.4.0-1.l0olq8++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
throw(ex);
^
TypeError: Cannot read property 'appId' of undefined
at meteorInstall.imports.startup.server.useraccounts-configuration.js (imports/startup/server/useraccounts-configuration.js:9:12)
at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:153:1)
at Module.require (packages/modules-runtime/.npm/package/node_modules/install/install.js:82:1)
at Module.Mp.import (/Users/sammyunterman/.meteor/packages/modules/.0.7.5.1f9ncrv++os+web.browser+web.cordova/npm/node_modules/reify/lib/runtime.js:70:16)
at meteorInstall.imports.startup.server.index.js (imports/startup/server/index.js:1:1)
at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:153:1)
at Module.require (packages/modules-runtime/.npm/package/node_modules/install/install.js:82:1)
at Module.Mp.import (/Users/sammyunterman/.meteor/packages/modules/.0.7.5.1f9ncrv++os+web.browser+web.cordova/npm/node_modules/reify/lib/runtime.js:70:16)
at meteorInstall.server.main.js (server/main.js:1:8)
at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:153:1)
Exited with code: 1
Your application is crashing. Waiting for file change.
Thank you #king-julian
It was the facebook ServiceConfigurationmethod in /imports/startup/server/useracounts-configuration.js.

Google autocomplete google.maps.__gjsload__ is not a function

i'm using google's autocomplete to fill address information on vtiger crm contacts module, using almost he exact same code (changing the ids of html elements) works fine in accounts but in contacts (were it worked for few days), without any changes it doesn't wroks... I have some js error in console
Uncaught TypeError: google.maps.\__gjsload__ is not a function(anonymous function) ... places_impl.js
Uncaught TypeError: google.maps.\__gjsload__ is not a function(anonymous function) ... controls.js
Uncaught TypeError: google.maps.\__gjsload__ is not a function(anonymous function) ... utils.js
Uncaught TypeError: google.maps.\__gjsload__ is not a function(anonymous function) ... commons.js
Has someone faced this problem?
It was my mistake, I was including google's api in other html to use a map... sry

Node.js Box2dWeb error caused by require()

I'm trying to make a server using Node.js and Box2dWeb engine. But trying to "import" the "box2d.js" throws me a random error which doesn't seem to be related with what I'm doing. Here's the code that's causing the error:
var Box2D = require('./box2d.js');
Here's the error:
console.js:55
this._stdout.write(util.format.apply(this, arguments) + '\n');
^
TypeError: Cannot read property 'write' of undefined
at Console.log (console.js:55:15)
at TCPServer.<anonymous> (C:\Users\conne_000\Documents\ntm2\NTM2Server2\main
.js:16:10)
at TCPServer.emit (events.js:129:20)
at Server.<anonymous> (C:\Users\conne_000\Documents\ntm2\NTM2Server2\classes\servers\tcp_server.js:20:8)
at Server.emit (events.js:104:17)
at net.js:1171:12
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
at node.js:814:3
Press any key to continue . . .
I have no idea on what to do about this. Any help is very much appreciated!

How to enable PouchDB Debug in Angular

I am developing a prototype web application. I used Yeoman to create an Angular application with Grunt, NPM, and Bower etc. The PouchDB API says you can enable debugging like so:
PouchDB.debug.enable('*');
This however requires the node debug module to be installed. I have tried installing it via bower and referencing it in my index.html but to no avail. How do I inject the debug module into Angular? Or is this function only available when the PouchDB is ran from a Node.js server?
EDIT:
The exact error I am getting is bellow. The line it complains about is: PouchDB.debug.enable('*');
TypeError: Cannot read property 'enable' of undefined
at new <anonymous> (http://localhost:9000/scripts/services/taskdb.js:13:15)
at invoke (http://localhost:9000/bower_components/angular/angular.js:4129:17)
at Object.instantiate (http://localhost:9000/bower_components/angular/angular.js:4140:23)
at Object.<anonymous> (http://localhost:9000/bower_components/angular/angular.js:3998:24)
at Object.invoke (http://localhost:9000/bower_components/angular/angular.js:4129:17)
at Object.enforcedReturnValue [as $get] (http://localhost:9000/bower_components/angular/angular.js:3982:37)
at Object.invoke (http://localhost:9000/bower_components/angular/angular.js:4129:17)
at http://localhost:9000/bower_components/angular/angular.js:3947:37
at getService (http://localhost:9000/bower_components/angular/angular.js:4088:39)
at Object.invoke (http://localhost:9000/bower_components/angular/angular.js:4120:13)
angular.js:11413 TypeError: Cannot read property 'enable' of undefined
at new <anonymous> (http://localhost:9000/scripts/services/taskdb.js:13:15)
at invoke (http://localhost:9000/bower_components/angular/angular.js:4129:17)
at Object.instantiate (http://localhost:9000/bower_components/angular/angular.js:4140:23)
at Object.<anonymous> (http://localhost:9000/bower_components/angular/angular.js:3998:24)
at Object.invoke (http://localhost:9000/bower_components/angular/angular.js:4129:17)
at Object.enforcedReturnValue [as $get] (http://localhost:9000/bower_components/angular/angular.js:3982:37)
at Object.invoke (http://localhost:9000/bower_components/angular/angular.js:4129:17)
at http://localhost:9000/bower_components/angular/angular.js:3947:37
at getService (http://localhost:9000/bower_components/angular/angular.js:4088:39)
at invoke (http://localhost:9000/bower_components/angular/angular.js:4120:13) <div ng-view="" class="ng-scope">
When you use PouchDB, the debug module is already installed. You don't need to do anything except call PouchDB.debug.enable('*'). :)
Note that in PouchDB v7.0.0 loading a separate plugin is required for this.

Categories