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.

TypeError: cannot read property 'dataXXXXX' of null

See original GitHub issue

Issue details

I am getting the following TypeError in the browser console when running BrowserSync with our project:

Chrome stacktrace:

Uncaught TypeError: Cannot read property 'data1455815651327' of null
getData @ browser-sync-client.2.11.1.js:129
addEvent @ browser-sync-client.2.11.1.js:129
n.init @ browser-sync-client.2.11.1.js:129
n.init @ browser-sync-client.2.11.1.js:129
n.init @ browser-sync-client.2.11.1.js:129
Emitter.emit @ browser-sync-client.2.11.1.js:1
Socket.onevent @ browser-sync-client.2.11.1.js:1
Socket.onpacket @ browser-sync-client.2.11.1.js:1
(anonymous function) @ browser-sync-client.2.11.1.js:1
Emitter.emit @ browser-sync-client.2.11.1.js:1
Manager.ondecoded @ browser-sync-client.2.11.1.js:1
(anonymous function) @ browser-sync-client.2.11.1.js:1
Emitter.emit @ browser-sync-client.2.11.1.js:1
Decoder.add @ browser-sync-client.2.11.1.js:3
Manager.ondata @ browser-sync-client.2.11.1.js:1
(anonymous function) @ browser-sync-client.2.11.1.js:1
Emitter.emit @ browser-sync-client.2.11.1.js:1
Socket.onPacket @ browser-sync-client.2.11.1.js:1
(anonymous function) @ browser-sync-client.2.11.1.js:1
Emitter.emit @ browser-sync-client.2.11.1.js:1
Transport.onPacket @ browser-sync-client.2.11.1.js:1
callback @ browser-sync-client.2.11.1.js:2
(anonymous function) @ browser-sync-client.2.11.1.js:2
exports.decodePayloadAsBinary @ browser-sync-client.2.11.1.js:2
exports.decodePayload @ browser-sync-client.2.11.1.js:2
Polling.onData @ browser-sync-client.2.11.1.js:2
(anonymous function) @ browser-sync-client.2.11.1.js:2
Emitter.emit @ browser-sync-client.2.11.1.js:1
Request.onData @ browser-sync-client.2.11.1.js:2
Request.onLoad @ browser-sync-client.2.11.1.js:2
xhr.onreadystatechange @ browser-sync-client.2.11.1.js:2

Safari stacktrace:

TypeError: null is not an object (evaluating 'n')
getDatabrowser-sync-client.2.11.1.js:128:6154
addEventbrowser-sync-client.2.11.1.js:128:7675
initbrowser-sync-client.2.11.1.js:128:9018
initbrowser-sync-client.2.11.1.js:128:12388
initbrowser-sync-client.2.11.1.js:128:15014
emitbrowser-sync-client.2.11.1.js:1:16414
oneventbrowser-sync-client.2.11.1.js:1:11598
onpacketbrowser-sync-client.2.11.1.js:1:11116
(anonymous function)browser-sync-client.2.11.1.js:1:15045
emitbrowser-sync-client.2.11.1.js:1:16414
ondecodedbrowser-sync-client.2.11.1.js:1:5895
(anonymous function)browser-sync-client.2.11.1.js:1:15045
emitbrowser-sync-client.2.11.1.js:1:16414
addbrowser-sync-client.2.11.1.js:2:11609
ondatabrowser-sync-client.2.11.1.js:1:5833
(anonymous function)browser-sync-client.2.11.1.js:1:15045
emitbrowser-sync-client.2.11.1.js:1:16414
onPacketbrowser-sync-client.2.11.1.js:1:25252
(anonymous function)browser-sync-client.2.11.1.js:1:22153
emitbrowser-sync-client.2.11.1.js:1:16414
onPacketbrowser-sync-client.2.11.1.js:1:30682
callbackbrowser-sync-client.2.11.1.js:1:9198
(anonymous function)browser-sync-client.2.11.1.js:1:26899
forEach
decodePayloadAsBinarybrowser-sync-client.2.11.1.js:1:26871
decodePayloadbrowser-sync-client.2.11.1.js:1:23449
onDatabrowser-sync-client.2.11.1.js:1:9228
(anonymous function)browser-sync-client.2.11.1.js:1:4191
emitbrowser-sync-client.2.11.1.js:1:16414
onDatabrowser-sync-client.2.11.1.js:1:6169
onLoadbrowser-sync-client.2.11.1.js:1:6941
onreadystatechangebrowser-sync-client.2.11.1.js:1:5783

Firefox stacktrace:

TypeError: o is null
[6]</n._ElementCache/this.getData()
 browser-sync-client.2.11.1.js:129
[6]</n._EventManager/this.addEvent()
 browser-sync-client.2.11.1.js:129
[7]</n.init()
 browser-sync-client.2.11.1.js:129
[12]</n.init()
 browser-sync-client.2.11.1.js:129
[15]</n.init()
 browser-sync-client.2.11.1.js:129
[9]</Emitter.prototype.emit()
 browser-sync-client.2.11.1.js:1
[5]</Socket.prototype.onevent()
 browser-sync-client.2.11.1.js:1
[5]</Socket.prototype.onpacket()
 browser-sync-client.2.11.1.js:1
[8]</module.exports/<()
 browser-sync-client.2.11.1.js:1
[9]</Emitter.prototype.emit()
 browser-sync-client.2.11.1.js:1
[3]</Manager.prototype.ondecoded()
 browser-sync-client.2.11.1.js:1
[8]</module.exports/<()
 browser-sync-client.2.11.1.js:1
[9]</Emitter.prototype.emit()
 browser-sync-client.2.11.1.js:1
[44]</Decoder.prototype.add()
 browser-sync-client.2.11.1.js:3
[3]</Manager.prototype.ondata()
 browser-sync-client.2.11.1.js:1
[8]</module.exports/<()
 browser-sync-client.2.11.1.js:1
[9]</Emitter.prototype.emit()
 browser-sync-client.2.11.1.js:1
[13]</</Socket.prototype.onPacket()
 browser-sync-client.2.11.1.js:1
[13]</</Socket.prototype.setTransport/<()
 browser-sync-client.2.11.1.js:1
[9]</Emitter.prototype.emit()
 browser-sync-client.2.11.1.js:1
[14]</Transport.prototype.onPacket()
 browser-sync-client.2.11.1.js:1
[18]</Polling.prototype.onData/callback()
 browser-sync-client.2.11.1.js:2
[25]</</exports.decodePayloadAsBinary/<()
 browser-sync-client.2.11.1.js:2
forEach()
 self-hosted:216
[25]</</exports.decodePayloadAsBinary()
 browser-sync-client.2.11.1.js:2
[25]</</exports.decodePayload()
 browser-sync-client.2.11.1.js:2
[18]</Polling.prototype.onData()
 browser-sync-client.2.11.1.js:2
[17]</</XHR.prototype.doPoll/<()
 browser-sync-client.2.11.1.js:2
[9]</Emitter.prototype.emit()
 browser-sync-client.2.11.1.js:1
[17]</</Request.prototype.onData()
 browser-sync-client.2.11.1.js:2
[17]</</Request.prototype.onLoad()
 browser-sync-client.2.11.1.js:2
[17]</</Request.prototype.create/xhr.onreadystatechange()

Please specify which version of Browsersync, node and npm you’re running

  • Browsersync [ 2.11.1 ]
  • Node [ 5.4.1 ]
  • Npm [ 3.3.12 ]
  • Gulp [ 3.9.0 ]

Affected platforms

  • linux
  • windows
  • OS X
  • freebsd
  • solaris
  • other (please specify which)

Browsersync use-case

  • API
  • Gulp
  • Grunt
  • CLI

for all other use-cases, (gulp, grunt etc), please show us exactly how you’re using Browsersync

var gulp = require('gulp'),
  browserSync = require('browser-sync'),
  url = require('url'), // npmjs.org/package/url
  proxy = require('proxy-middleware'); // npmjs.org/package/proxy-middleware

var proxyFunc = proxy(url.parse('http://localhost:8080'));

// this task utilizes the browsersync plugin
// to create a dev server instance
// at http://localhost:8081
gulp.task('serve', function (done) {
  browserSync({
    online: false,
    open: false,
    port: 8088,
    logLevel: 'debug',
    server: {
      baseDir: ['dev'],
      middleware: function (req, res, next) {
        if (req.url.match(/^\/core\//)) {
          proxyFunc(req, res, next);
        } else {
          res.setHeader('Access-Control-Allow-Origin', '*');
          next();
        }
      }
    }
  }, done);
});


Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9

github_iconTop GitHub Comments

5reactions
porfidevcommented, Apr 12, 2016

If you use Angular Before Jquery… angular will use JQLite instead jQuery.

This is helpfull untill you directive works with Jquery instead jQLite.

2reactions
jmitch0901commented, Apr 11, 2016

I had the same error. I fixed it by placing the angular script before the jQuery scipt tag in my index.html file. No idea why this worked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using angular, jquery, browser-sync · Issue #1062 - GitHub
... with Uncaught TypeError: Cannot read property 'dataXXXXX' of null ... When AngularJS is loaded first, then jQuery, BrowserSync doesn't ...
Read more >
Best way to insert 10000 JSON files (total 30GB) into MongoDB
The easiest way would be to write a Node program that processes one JSON file and then run it multiple time from the...
Read more >
row().scrollTo() not working - DataTables forums
dataTables.js:112 Uncaught TypeError: Cannot set property '$' of undefined ... I cannot get the render function to be called on my datatable.
Read more >
Java 7.5 Generator - GeneXus
On executing a create database on PosgreSQL 7.4 with Java (JDBC), it fails with an error of the following type: 'ERROR: relation "XXXX"...
Read more >
sitemap.xml - CloudBlue - Freshdesk
... -a-custom-logo-for-a-brand-can-t-read-data-error- 2020-01-22T23:32:54+05:30 ... -database-task-fails-this-property-is-not-available-on-sql-server-7-0- ...
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