A
A
Alexey Yakovlev2020-08-31 15:56:15
Handlebars
Alexey Yakovlev, 2020-08-31 15:56:15

Error when starting a project on gulp, what to do?

gulpFIle(hbs):

gulp.task("hbs", () => {
    return gulp.src("src/views/**/*.hbs")
        .pipe(webpack({
            mode: 'development',
            module: {
                rules: [
                    {
                        test: /\.hbs$/,
                        use: ["handlebars-loader"]
                    }
                ]
            }
        }))
        .pipe(gulp.dest('dist/views'))
        .pipe(browserSync.stream());
});


Created a folder views index.hbs, ... --> layouts main.hbs, ..., partials head.hbs, ...

main.hbs:
{{> head }}
<body>
    {{> header }}

    {{{ body }}}

    {{> down }}
</body>
</html>


Error:
[15:46:38] 'hbs' errored after 46 s
[1] [15:46:38] Error in plugin "webpack-stream"
[1] Message:
[1] ./src/views/layouts/ empty.hbs
[1] Module build failed (from ./node_modules/handlebars-loader/index.js):
[1] Error: Partial './head' not found
[1] at tryExtension (/home/alexey/Desktop /ryc-store/node_modules/handlebars-loader/index.js:291:27)
[1] at /home/alexey/Desktop/ryc-store/node_modules/handlebars-loader/index.js:299:11
[1 ] at next (/home/alexey/Desktop/ryc-store/node_modules/handlebars-loader/index.js:241:20)
[1] at /home/alexey/Desktop/ryc-store/node_modules/handlebars- loader/index.js:257:20
[1] at doResolve (/home/alexey/Desktop/ryc-store/node_modules/enhanced-resolve/lib/Resolver.js:213:14)
[1] at hook.callAsync (/home/alexey/Desktop/ ryc-store/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
[1] at _fn0 (eval at create (/home/alexey/Desktop/ryc-store/node_modules/tapable/lib/HookCodeFactory. js:33:10), :15:1)
[1] at resolver.doResolve (/home/alexey/Desktop/ryc-store/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7)
[1 ] at hook.callAsync (/home/alexey/Desktop/ryc-store/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
[1] at _fn0 (eval at create (/home/alexey/Worker table/ryc-store/node_modules/tapable/lib/HookCodeFactory.js:33:10), :15:1)
[1] @ multi ./src/views/index.hbs ./src/views/product.hbs ./src/views/sale.hbs ./src/views/layouts/empty.hbs ./src/views/layouts /main.hbs ./src/views/partials/down.hbs ./src/views/partials/head.hbs ./src/views/partials/header.hbs ./src/views/partials/preolaider.hbs ./ src/views/partials/up.hbs main[3]
[1] ./src/views/layouts/main.hbs
[1] Module build failed (from ./node_modules/handlebars-loader/index.js):
[1 ] Error: Partial './head' not found
[1] at tryExtension (/home/alexey/Desktop/ryc-store/node_modules/handlebars-loader/index.js:291:27)
[1] at /home/ alexey/Desktop/ryc-store/node_modules/handlebars-loader/index.js:299:11
[1] at next (/home/alexey/Desktop/ryc-store/node_modules/handlebars-loader/index.js: 241:20)
[1] at /home/alexey/Desktop/ryc-store/node_modules/handlebars-loader/index.js:257:20
[1] at doResolve (/home/alexey/Desktop/ryc-store/node_modules/enhanced -resolve/lib/Resolver.js:213:14)
[1] at hook.callAsync (/home/alexey/Desktop/ryc-store/node_modules/enhanced-resolve/lib/Resolver.js:285:5)
[ 1] at _fn0 (eval at create (/home/alexey/Desktop/ryc-store/node_modules/tapable/lib/HookCodeFactory.js:33:10), :15:1)
[1] at resolver.doResolve (/ home/alexey/Desktop/ryc-store/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7)
[1] at hook.callAsync (/home/alexey/Desktop/ryc-store/node_modules/enhanced -resolve/lib/Resolver.js:285:5)
[1] at _fn0 (eval at create (/home/alexey/Desktop/ryc-store/node_modules/tapable/lib/HookCodeFactory.js:33:10), :15:1)
[1] @ multi ./src /views/index.hbs ./src/views/product.hbs ./src/views/sale.hbs ./src/views/layouts/empty.hbs ./src/views/layouts/main.hbs ./src/ views/partials/down.hbs ./src/views/partials/head.hbs ./src/views/partials/header.hbs ./src/views/partials/preolaider.hbs ./src/views/partials/up. hbs main[4]

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question