ericf / express-handlebars

A Handlebars view engine for Express which doesn't suck.
BSD 3-Clause "New" or "Revised" License
2.31k stars 384 forks source link

Builtin helper lookup is showing missing #289

Closed Gourav2000 closed 3 years ago

Gourav2000 commented 3 years ago

Error: Missing helper: 'lookup' at new Exception (D:\doc\web devlopment\ApplicationCustomization\Random-stuffs\node_modules\express3-handlebars\node_modules\handlebars\dist\cjs\handlebars\exception.js:13:41) at String. (D:\doc\web devlopment\ApplicationCustomization\Random-stuffs\node_modules\express3-handlebars\node_modules\handlebars\dist\cjs\handlebars\base.js:57:13) at program1 (eval at createFunctionContext (D:\doc\web devlopment\ApplicationCustomization\Random-stuffs\node_modules\express3-handlebars\node_modules\handlebars\dist\cjs\handlebars\compiler\javascript-compiler.js:189:23), :13:255) at prog (D:\doc\web devlopment\ApplicationCustomization\Random-stuffs\node_modules\express3-handlebars\node_modules\handlebars\dist\cjs\handlebars\runtime.js:107:15) at Object. (D:\doc\web devlopment\ApplicationCustomization\Random-stuffs\node_modules\express3-handlebars\node_modules\handlebars\dist\cjs\handlebars\base.js:99:23) at Object.eval (eval at createFunctionContext (D:\doc\web devlopment\ApplicationCustomization\Random-stuffs\node_modules\express3-handlebars\node_modules\handlebars\dist\cjs\handlebars\compiler\javascript-compiler.js:189:23), :33:25) at D:\doc\web devlopment\ApplicationCustomization\Random-stuffs\node_modules\express3-handlebars\node_modules\handlebars\dist\cjs\handlebars\runtime.js:86:31 at D:\doc\web devlopment\ApplicationCustomization\Random-stuffs\node_modules\express3-handlebars\node_modules\handlebars\dist\cjs\handlebars\compiler\compiler.js:465:21 at ExpressHandlebars._renderTemplate (D:\doc\web devlopment\ApplicationCustomization\Random-stuffs\node_modules\express3-handlebars\lib\express-handlebars.js:339:22) at ExpressHandlebars.renderTemplate (D:\doc\web devlopment\ApplicationCustomization\Random-stuffs\node_modules\express3-handlebars\lib\express-handlebars.js:196:18)

`

                    {{#each itemsd.categories  }}
                    <li><button type="button" class="catButton" onclick="showitemForm('{{this}}')">{{this}}</button></li>

                    <h2> Items</h2>
                    <ul>

                      {{#each (lookup ../itemsd.items this) }}    
                            <h1>{{this.name}}</h1>
                      {{/each}}  

                    </ul>
                    <div class="{{this}}" style="visibility: hidden;">
                            <form action="/admin" method="POST">
                                    ItemName:<input type='text' name='itemname' value=""><br>
                                    Price:<input type='text' name='price' value=""><br>
                                    Size:<input type='text' name='size' value=""><br>
                                    Description:<input type='text' name='description' value=""><br>
                                    <input type="text" name="category" value="{{this}}" style="visibility:hidden;">
                                    <button type="submit">Submit</button>
                            </form>
                    </div>
                    {{/each}}
            </div>`
UziTech commented 3 years ago

How did you define the lookup helper?

UziTech commented 3 years ago

Looks like you might be using lookup wrong. Or this is an issue for the https://github.com/handlebars-lang/handlebars.js repo

UziTech commented 3 years ago

Also new development for express-handlebars has moved to https://github.com/express-handlebars/express-handlebars

Gourav2000 commented 3 years ago

How did you define the lookup helper?

It's supposed to be a built in helper for handlebars, I could use all other built in helpers like {{#each}} , {{#with}}, without issue but lookup is not getting identified as a built in helper https://handlebarsjs.com/guide/builtin-helpers.html#lookup

UziTech commented 3 years ago

It looks like you are using an old version. express3-handlebars is no longer maintained. Use express-handlebars instead.