Question: EJS error: Unexpected token < in NodeJS app

Question

EJS error: Unexpected token < in NodeJS app

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

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">
      <h1>Home</h1>   
    </div>

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

This is the main_header.ejs partial:

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

      <head>

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

        <!-- EXTERNAL RESOURCES -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />

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

     </head>
  <body>

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+https://Camille500@github.com/camille500/heroku-application.git"
  },
  "author": "Camille Sébastien Niessen",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/camille500/heroku-application/issues"
  },
  "homepage": "https://github.com/camille500/heroku-application#readme",
  "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?

Thanks!

Answers to

EJS error: Unexpected token &lt; in NodeJS app

Source Show
◀ Wstecz