Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial could not be found error #1709

Closed
namPS opened this issue Sep 6, 2020 · 1 comment
Closed

Partial could not be found error #1709

namPS opened this issue Sep 6, 2020 · 1 comment

Comments

@namPS
Copy link

namPS commented Sep 6, 2020

Partial not found error when deployed to Digital Ocean, tried changing file name, adding hbs.registerPartials, but neither works.

> node ./bin/tasks/assemble "production"


events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: The partial global/header could not be found
    at Object.invokePartial (/one-table/node_modules/handlebars/dist/cjs/handlebars/runtime.js:332:11)
    at Object.handlebars.VM.invokePartial (/one-table/node_modules/engine-handlebars/index.js:196:26)
    at Object.invokePartialWrapper [as invokePartial] (/one-table/node_modules/handlebars/dist/cjs/handlebars/runtime.js:84:39)
    at Object.eval (eval at createFunctionContext (/one-table/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:262:23), <anonymous>:10:31)
    at main (/one-table/node_modules/handlebars/dist/cjs/handlebars/runtime.js:208:32)
    at ret (/one-table/node_modules/handlebars/dist/cjs/handlebars/runtime.js:212:12)
    at ret (/one-table/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:519:21)
    at Object.render (/one-table/node_modules/engine-handlebars/index.js:94:14)
    at /one-table/node_modules/engine-cache/index.js:251:14
    at Object.engineRender [as render] (/one-table/node_modules/engine-cache/index.js:287:7)

config.js

var express = require('express');
var bodyParser = require('body-parser');
const methodOverride = require('method-override');
var errorHandler = require('errorhandler');
var path = require('path');
var exphbs = require('express-handlebars');
const helpers = require( 'handlebars-helpers')();

module.exports = function() {
  var app = express();

  app.engine('.hbs', exphbs({
    extname: '.hbs',
    helpers: require(path.join(__dirname, 'src', 'templates', 'helpers', 'render')),
    layoutsDir: path.join(__dirname, 'src','templates', 'layouts'),
    partialsDir: path.join(__dirname, 'src','templates', 'partials'),
    defaultLayout: 'default'
  }));

  app.set('port', 8080);
  app.set('views', path.join(__dirname, 'src','templates','pages'));
  app.set('view engine', 'hbs');
  app.use(bodyParser.urlencoded({ extended: true }));
  app.use(bodyParser.json());
  app.use(methodOverride());
  app.use(errorHandler());
  app.use(express.static(path.join(__dirname, './build')));

  return app;
}();
@jaylinski
Copy link
Member

Please open an issue in the express-handlebars project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants