Я не уверен, почему я получаю эту ошибку. Мой e js синтаксис "include" выглядит правильно, и я считаю, что правильно ввел пути к файлам. Я посмотрел на старые сообщения stackoverflow и пришел пустой. Любые указатели будут высоко оценены.
Error: Could not find matching close tag for "<%-".
at /Users/lorenzi/Desktop/startbootstrap-clean-blog/node_modules/ejs/lib/ejs.js:710:19
at Array.forEach (<anonymous>)
at Template.generateSource (/Users/lorenzi/Desktop/startbootstrap-clean-blog/node_modules/ejs/lib/ejs.js:700:15)
at Template.compile (/Users/lorenzi/Desktop/startbootstrap-clean-blog/node_modules/ejs/lib/ejs.js:554:12)
at Object.compile (/Users/lorenzi/Desktop/startbootstrap-clean-blog/node_modules/ejs/lib/ejs.js:368:16)
at handleCache (/Users/lorenzi/Desktop/startbootstrap-clean-blog/node_modules/ejs/lib/ejs.js:216:18)
at tryHandleCache (/Users/lorenzi/Desktop/startbootstrap-clean-blog/node_modules/ejs/lib/ejs.js:255:16)
at View.exports.renderFile [as engine] (/Users/lorenzi/Desktop/startbootstrap-clean-blog/node_modules/ejs/lib/ejs.js:461:10)
at View.render (/Users/lorenzi/Desktop/startbootstrap-clean-blog/node_modules/express/lib/view.js:135:8)
at tryRender (/Users/lorenzi/Desktop/startbootstrap-clean-blog/node_modules/express/lib/application.js:640:10)
вот мой индекс. js file
const express = require('express')
const path = require('path')
const app = new express()
const ejs = require('ejs')
const bodyParser = require('body-parser')
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended:true}))
app.set('view engine','ejs')
app.set('views', '/Users/lorenzi/Desktop/startbootstrap-clean-blog/views');
app.use(express.static('public'))
app.listen(4000, ()=>{
console.log('App listening on port 4000 ...')
})
app.get('/', (req, res) => {
res.render('index');
});
app.get('/about',(req,res)=>{
res.render('about');
})
app.get('/contact',(req,res)=>{
res.render('contact');
})
app.get('/post',(req,res)=>{
res.render('post')
})
вот мой основной оператор включения из моего index.e js file
<%- include('layouts/header'); -%>
<%- include('layouts/navbar'); -%>
<%- include('layouts/footer'); -%>
<%- include('layouts/scripts'); -%>
index.e js
<!DOCTYPE html>
<html lang="en">
<%- include('layouts/header'); -%>
<body>
<%- include('layouts/navbar'); -%>
<!-- Page Header -->
<header class="masthead" style="background-image: url('img/home-bg.jpg')">
<div class="overlay"></div>
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
<div class="site-heading">
<h1>Clean Blog</h1>
<span class="subheading">A Blog Theme by Start Bootstrap</span>
</div>
</div>
</div>
</div>
</header>
<!-- Main Content -->
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
<div class="post-preview">
<a href="post.html">
<h2 class="post-title">
Man must explore, and this is exploration at its greatest
</h2>
<h3 class="post-subtitle">
Problems look mighty small from 150 miles up
</h3>
</a>
<p class="post-meta">Posted by
<a href="#">Start Bootstrap</a>
on September 24, 2019</p>
</div>
<hr>
<div class="post-preview">
<a href="post.html">
<h2 class="post-title">
I believe every human has a finite number of heartbeats. I don't intend to waste any of mine.
</h2>
</a>
<p class="post-meta">Posted by
<a href="#">Start Bootstrap</a>
on September 18, 2019</p>
</div>
<hr>
<div class="post-preview">
<a href="post.html">
<h2 class="post-title">
Science has not yet mastered prophecy
</h2>
<h3 class="post-subtitle">
We predict too much for the next year and yet far too little for the next ten.
</h3>
</a>
<p class="post-meta">Posted by
<a href="#">Start Bootstrap</a>
on August 24, 2019</p>
</div>
<hr>
<div class="post-preview">
<a href="post.html">
<h2 class="post-title">
Failure is not an option
</h2>
<h3 class="post-subtitle">
Many say exploration is part of our destiny, but it’s actually our duty to future generations.
</h3>
</a>
<p class="post-meta">Posted by
<a href="#">Start Bootstrap</a>
on July 8, 2019</p>
</div>
<hr>
<!-- Pager -->
<div class="clearfix">
<a class="btn btn-primary float-right" href="#">Older Posts →</a>
</div>
</div>
</div>
</div>
<hr>
<%- include('layouts/footer'); -%>
<%- include('layouts/scripts'); -%>
</body>
</html>
header.e js
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Clean Blog - Start Bootstrap Theme</title>
<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom fonts for this template -->
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href='https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<!-- Custom styles for this template -->
<link href="css/clean-blog.min.css" rel="stylesheet">
</head>