How do I fix this problem? I'm new to HTML & Node.js programming. I tried but it was harder than I expected
<!-- File name: index.ejs
Author's name: Hae Yeon Kang (Lucy)
web site name: Hae Yeon's Portfolio Website
URL: haeyeonkang.azurewebsites.net
file description: This is the main page of the website.
-->
<% include ../partials/header %>
<body >
<header id="top" >
<div >
<div >
<img src="images/logo.png" alt="HAE YEON KANG" width="300" />
<p>
<br/>
</p>
<h4 style="font-size: 15pt; font-family: Courier New;">
Hi, it is great to meet you.
<br/>I'm Hae Yeon Kang, a Computer Programmer, <br/>and welcome to my portfolio website.
</h4>
<br/>
<a href="/about" >Click Here!</a>
</div>
</div>
</header>
<% include ../partials/footer %>
`
Eror that it exported
Unexpected token '.' in D:\hack\hacktoberfest-museum-main\hacktoberfest-museum-main\PortOr\Node.js-Portfolio-Website\server\views\pages\index.ejs while compiling ejs If the above error is not helpful, you may want to try EJS-Lint: https://github.com/RyanZim/EJS-Lint Or, if you meant to create an async function, pass `async: true` as an option.
SyntaxError: Unexpected token '.' in D:\hack\hacktoberfest-museum-main\hacktoberfest-museum-main\PortOr\Node.js-Portfolio-Website\server\views\pages\index.ejs while compiling ejs
If the above error is not helpful, you may want to try EJS-Lint:
https://github.com/RyanZim/EJS-Lint
Or, if you meant to create an async function, pass `async: true` as an option.
at new Function (<anonymous>)
at Template.compile (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\[email protected]\node_modules\ejs\lib\ejs.js:673:12)
at Object.compile (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\[email protected]\node_modules\ejs\lib\ejs.js:398:16)
at handleCache (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\[email protected]\node_modules\ejs\lib\ejs.js:235:18)
at tryHandleCache (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\[email protected]\node_modules\ejs\lib\ejs.js:274:16)
at exports.renderFile [as engine] (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\[email protected]\node_modules\ejs\lib\ejs.js:491:10)
at View.render (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\[email protected]\node_modules\express\lib\view.js:135:8)
at tryRender (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\[email protected]\node_modules\express\lib\application.js:657:10)
at Function.render (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\[email protected]\node_modules\express\lib\application.js:609:3)
at ServerResponse.render (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\[email protected]\node_modules\express\lib\response.js:1039:7)
I tried this not worked also this.
It just weird that I tried pnpm install to requirement and it doesn't work.
CodePudding user response:
Your file references are not in quotations, they need to be like this:
<% include "../partials/header" %>
Also it looks you're using the wrong syntax to comment. Since this is an .erb
file, and not an .html
file you need to use:
<%# commented line %>
instead of <!-- ... -->
.