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.

Cannot read property 'connection' of undefined in client.connect()

See original GitHub issue

Actual behaviour: Using node-webkit v0.12.3 (Chromium 41.0.2272.76), when trying to use client.connect() after creating the client object with a set of options, an error is thrown - “Cannot read property ‘connection’ of undefined”

Expected behaviour: IRC client should connect without error

Error log:

var irc = require('tmi.js');
$scope.client = new irc.client({
    options: {
        debug: true
    },
    identity: {
        username: $scope.username,
        password: $scope.password
    },
    channels: [$scope.channel]
});
$scope.client.connect().then(function(data){
    console.log('connection data...');
    console.log(data);
}).catch(function(err){
    console.log('connection error...');
    console.log(err);
});

...
connection error...
Cannot read property 'connection' of undefined

Server configuration

  • Operating system: Windows 7 x64
  • Node version (if applicable): 5.8.0
  • NPM version (if applicable): 3.7.3
  • tmi.js version: 1.08

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
xingpedcommented, Jun 28, 2016

Haha, I forgot about it too! I actually did switch my project over to Electron a couple weeks ago and it worked perfectly without any modifications. Electron just seems a lot nicer than node-webkit anyways and doesn’t crash as much. So it isn’t an issue for me anymore!

0reactions
Schmoopiiecommented, Jun 28, 2016

Awesome 👍 Yeah it’s a lot better 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - TypeError: Cannot read property 'connect' of undefined
Correct way var MongoClient = require('mongodb').MongoClient; // it's not a function. Your way var MongoClient = require('mongodb').
Read more >
Cannot read property 'connection' of undefined #1227 - GitHub
I tried to install Ghost locally, but it kept giving me an error. Debug Information: OS: Ubuntu, v20.04 LTS Node Version: v12.18.0 Ghost...
Read more >
How to resolve a 'cannot read property connect of undefined ...
You get this error because the variable object is not defined, and trying to retrieve, set or mutate the property “id” on undefined...
Read more >
TypeError: Cannot read properties of undefined ... - MongoDB
I have this code here: import { MongoClient } from "mongodb"; const createConnection = () => { // let current = null; const...
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
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