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

Missing helper: "if_eq #4

Closed
publiclass1 opened this issue Sep 12, 2018 · 3 comments
Closed

Missing helper: "if_eq #4

publiclass1 opened this issue Sep 12, 2018 · 3 comments

Comments

@publiclass1
Copy link

hello @icebob , I got error generating moleculer init project project_name .

Error: Missing helper: "if_eq"
{ Error: Missing helper: "if_eq"
    at Object.<anonymous> (/Users/ralphmenguito/.config/yarn/global/node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js:19:13)
    at Object.eval [as main] (eval at createFunctionContext (/Users/ralphmenguito/.config/yarn/global/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), <anonymous>:6:72)
    at main (/Users/ralphmenguito/.config/yarn/global/node_modules/handlebars/dist/cjs/handlebars/runtime.js:175:32)
    at ret (/Users/ralphmenguito/.config/yarn/global/node_modules/handlebars/dist/cjs/handlebars/runtime.js:178:12)
    at ret (/Users/ralphmenguito/.config/yarn/global/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:526:21)
    at /Users/ralphmenguito/.config/yarn/global/node_modules/consolidate/lib/consolidate.js:876:16
    at /Users/ralphmenguito/.config/yarn/global/node_modules/consolidate/lib/consolidate.js:161:5
    at Promise._execute (/Users/ralphmenguito/.config/yarn/global/node_modules/bluebird/js/release/debuggability.js:313:9)
    at Promise._resolveFromExecutor (/Users/ralphmenguito/.config/yarn/global/node_modules/bluebird/js/release/promise.js:483:18)
    at new Promise (/Users/ralphmenguito/.config/yarn/global/node_modules/bluebird/js/release/promise.js:79:10)
    at promisify (/Users/ralphmenguito/.config/yarn/global/node_modules/consolidate/lib/consolidate.js:154:10)
    at exports.handlebars.render (/Users/ralphmenguito/.config/yarn/global/node_modules/consolidate/lib/consolidate.js:866:10)
    at async.each (/Users/ralphmenguito/.config/yarn/global/node_modules/moleculer-cli/src/init/index.js:313:4)
    at /Users/ralphmenguito/.config/yarn/global/node_modules/async/dist/async.js:3110:16
    at eachOfArrayLike (/Users/ralphmenguito/.config/yarn/global/node_modules/async/dist/async.js:1069:9)
    at eachOf (/Users/ralphmenguito/.config/yarn/global/node_modules/async/dist/async.js:1117:5)
    at Object.eachLimit (/Users/ralphmenguito/.config/yarn/global/node_modules/async/dist/async.js:3172:5)
    at Ware.<anonymous> (/Users/ralphmenguito/.config/yarn/global/node_modules/moleculer-cli/src/init/index.js:300:9)
    at Ware.<anonymous> (/Users/ralphmenguito/.config/yarn/global/node_modules/wrap-fn/index.js:45:19)
    at next (/Users/ralphmenguito/.config/yarn/global/node_modules/ware/lib/index.js:85:20)
    at /Users/ralphmenguito/.config/yarn/global/node_modules/wrap-fn/index.js:121:18
    at Ware.<anonymous> (/Users/ralphmenguito/.config/yarn/global/node_modules/moleculer-cli/src/init/index.js:284:3)
  description: undefined,
  fileName: undefined,
  lineNumber: undefined,
  message: 'Missing helper: "if_eq"',
  name: 'Error',
  number: undefined }

The generation of template was working before, except with this new updates on docker-compose.env that has if_eq .

Is there any work around to generate a template ?

@icebob
Copy link
Member

icebob commented Sep 12, 2018

I've just tested and it works fine. Do you use the latest moleculer-cli? Check with moleculer --version. The latest is v0.6.1

@publiclass1
Copy link
Author

$ node - v10.10.0

$ moleculer --version
0.6.1

It's resolve it by yarn global remove moleculer-cli and npm install -g moleculer-cli
I am not sure why yarn produced an error.

Thanks for the reply @icebob .

@arpan8
Copy link

arpan8 commented Jul 13, 2020

const exphbs = require("express-handlebars");
const hbs = exphbs.create({
extname: ".hbs",
helpers:{
if_eq: function(a, b, opts) {
if (a == b) return opts.fn(this);
else return opts.inverse(this);
}
}
});
app.engine(".hbs", hbs.engine);
app.set('view engine', 'hbs');

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

3 participants