Question: EJS error: Unexpected token < in NodeJS app


EJS error: Unexpected token < in NodeJS app

Answers 0
Added at 2017-01-03 22:01

I'm building a NodeJS application with the EJS template engine. I've used the same syntax as I did in an app I've build earlier, but on every rendered EJS page I get this error:

Uncaught SyntaxError: Unexpected token <

This is the code of one of my .ejs files:

  <%- include('partials/main_header.ejs') %>

    <div class="container-fluid">

  <%- include('partials/main_footer.ejs') %>

This is the main_header.ejs partial:

    <!DOCTYPE html>
     <html lang="en">


        <meta charset="UTF-8">
        <title>Heroku Node Application</title>

        <!-- EXTERNAL RESOURCES -->
        <link rel="stylesheet" href="" />

       <!-- MAIN CSS -->
       <link rel="stylesheet" type="text/css" href="dist/style/main.css" />


This is the package.json file with the packages I'm using

  "name": "heroku-node-application",
  "version": "1.0.0",
  "description": "First NodeJS Heroku Application",
  "main": "server.js",
  "scripts": {
    "build": "gulp",
    "start": "node server.js"
  "repository": {
    "type": "git",
    "url": "git+"
  "author": "Camille Sébastien Niessen",
  "license": "ISC",
  "bugs": {
    "url": ""
  "homepage": "",
  "dependencies": {
    "body-parser": "^1.15.2",
    "ejs": "^2.5.5",
    "express": "^4.14.0",
    "gulp": "^3.9.1",
    "gulp-concat": "^2.6.1",
    "gulp-connect": "^5.0.0",
    "gulp-rename": "^1.2.2",
    "gulp-sass": "^3.0.0",
    "gulp-sourcemaps": "^1.9.1",
    "gulp-uglify": "^2.0.0",
    "path": "^0.12.7"
  "devDependencies": {
    "gulp": "^3.9.1"

I've been looking for a solution, but I can't find an answer. Does anyone know how to solve this error?


Answers to

EJS error: Unexpected token &lt; in NodeJS app

Source Show
◀ Wstecz