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.

ejs throws error ` <%= ":" _ %>` for a space between _ and %> - SyntaxError: missing ) after argument list

See original GitHub issue

I had this error thrown by ejs which ejs-lint couldn’t detect.


err SyntaxError: missing ) after argument list in C:\model.ts while compiling ejs

If the above error is not helpful, you may want to try EJS-Lint:
https://github.com/RyanZim/EJS-Lint

for a code like,

<%= ":" _ %>

First of all it should not throw an error as this code has both <% and %>. But this ejs detects this space (’ ') between _ %> and throws an error.

It could be a meaning full error , may be like , its missing a closing ‘%>’ - would be more appropriate.

But it was very hard for me to locate this little space in the large file!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
mdecommented, Jan 8, 2018

In this case, the error is not coming from the EJS tag-matching code. It an ordinary JavaScript SyntaxError being thrown trying to parse ":" _, which is not valid JavaScript. This is not something ejs-lint can lint for – it’s actually valid EJS tags, just invalid JavaScript inside them. I agree it’s not a super-helpful error message, and sounds like it was difficult to find. I understand how frustrating that is. Since this isn’t an error specific to EJS, I’m going to go ahead and close this issue.

0reactions
HASSANALI2022commented, Dec 21, 2022

<% if(kindOfDay === “Saturday” || kindOfDay === “Sunday”){ %>

<%= kindOfDay%> ToDo List

<% } else %> {

<%= kindOfDay%> ToDO List

<% } %> SyntaxError: Missing catch or finally after try in C:\Users\Admin\desktop\to-do-list\views\List.ejs while compiling ejs

If the above error is not helpful, you may want to try EJS-Lint:

Read more comments on GitHub >

github_iconTop Results From Across the Web

SyntaxError: missing ) after argument list - JavaScript | MDN
The JavaScript exception "missing ) after argument list" occurs when there is an error with how a function is called. This might be...
Read more >
SyntaxError: missing ) after argument list in while compiling ejs
I tried many times, but I can't find the problem. Here's the ejs that causes errors. What is the problem with this code?...
Read more >
syntaxerror: missing ) after argument list in while compiling ejs
The JavaScript exception "missing) after argument list" occurs when there is an error with how a function is called. This might be a...
Read more >
JavaScript SyntaxError - Missing ) after argument list
This JavaScript exception missing ) after argument list occurs if there is an error in function calls. This could be a typing mistake,...
Read more >
How to use EJS to template your Node.js application
Template your Node.js apps with EJS, a simple and powerful templating engine that generates HTML markup from JavaScript quickly and easily.
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