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.

ReferenceError is not defined

See original GitHub issue

I check exists object in template, if exists then work good. But if no exists I get exception ReferenceError: e is not defined. Do I know somehow?

<input type="text" id="username" name="username" placeholder="Username" class="text ${(e) ? 'error' : ''}" autocomplete="off">

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
dondidocommented, Oct 29, 2019

@jmsherry well spotted! Just applied the fix, so pull in the latest 😃

1reaction
christiaanwesterbeekcommented, Aug 9, 2018

Wow, yeah I got this too. And here it is; a days old issue with the same. Cool 😃

In my case, the template uses a variable that is not in locals.

The actual problem is: It’s not catchable so the server dies.

I tried:

res.render('template', { locals }, err => {
    next(createError(500, `Template error: ${err.toString()}`))
})

And

try {
   res.render('template', { locals })
} catch (err) {
    next(createError(500, `Template error: ${err.toString()}`))
}

In both instances, the web server dies. I need to fix my variables. I know. But I also want to protect my server against a rogue commit to my template variables and nicely show a 500 page instead of ending up with a dead web server.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught ReferenceError: $ is not defined? - Stack Overflow
The most common reason behind the error "Uncaught ReferenceError: $ is not defined" is executing the jQuery code before the jQuery library ......
Read more >
ReferenceError: "x" is not defined - JavaScript - MDN Web Docs
ReferenceError : "x" is not defined. The JavaScript exception "variable is not defined" occurs when there is a non-existent variable referenced somewhere.
Read more >
How to Fix Uncaught ReferenceError: $ is not defined in jQuery
The most common reason behind the error "Uncaught ReferenceError: $ is not defined" is executing the jQuery code before the jQuery library file...
Read more >
Uncaught ReferenceError: $ is not defined
Uncaught ReferenceError: $ is not defined: This usually indicates that jQuery is not loaded and JavaScript does not recognize $. Even with $(document).ready ......
Read more >
Uncaught ReferenceError: $ is not defined - STechies
While programming in JavaScript, jQuery or Angular JS, coders often encounter an error called Uncaught ReferenceError: $ is not defined.
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