Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8313655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:33:46+00:00 2026-06-08T20:33:46+00:00

I have the usual nodejs express app… var express = require(‘express’); var app =

  • 0

I have the usual nodejs express app…

var express = require('express');

var app = express.createServer(
    express.bodyParser()
);

app.configure( function () {
    app.set('views', __dirname + '/views');
    app.set('view engine', 'ejs');
    app.use("/public", express.static(__dirname + '/public'));
});

app.get('/', function (req, res) {
    res.render('index');
});

I have a index.ejs and layout.ejs in /views folder:

layout.ejs:

<!doctype html>
<html lang="en" manifest=""><head>
    <title>jQuery Plugin Demo</title>
</head>
<body>
    <div class="container container-fluid">
        <%- body %>
    </div>
</body>
</html>

index.ejs:

Hello world

index.ejs only renders the “Hello world” text without the surrounding layout.ejs wrapper. The ejs is working. It’s able to find the correct .ejs template, but it’s just ignoring the layout. I’ve also tried explictly adding layout file to app..

app.set('view options', { layout:'layout.ejs' }); 

All of this works fine locally, but not on Heroku. Here is my package.json:

{
  "name": "in1-test",
  "version": "0.0.1",
  "author": "Iatek",
  "dependencies": {
    "express": ">=2.5.x",
    "ejs": ">=0.7.x"
  },
  "engines": {
    "node": "0.6.x"
  }
}

Why no joy on the layout??? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T20:33:48+00:00Added an answer on June 8, 2026 at 8:33 pm

    When you deploy to Heroku it does an npm install for all your dependencies; because you have stated express >=2.5.x it will install the latest which is 3.0.0_betax. Express 3 does not have support for layouts in ejs (yet).

    To fix remove the “>=” and specify the version of express that is in your local version.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Rails app with the usual application_controller, and a controller (and model)
I have installed the latest libxml2-2.8.0 , as usual: $ ./configure , $ make
I have a Singleton WPF app so don't have the usual app.xaml. Instead I
I have an app that is mostly in rails but also uses nodejs for
I have a usual login form consisting of two input fields, one for login,
I have a usual editButtonItem in my navigationBar (created by the system), and I'd
I have a problem with Ebean. I have the usual Objects PsecUser, PsecRoles and
I have looked at the usual suspects...Spark, NHaml, etc. They all seem to be
Apple have long blocked mobile Safari from playing sounds – the usual JavaScript commands
I have the following code and it's working (as usual) in everything but IE.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.