我該如何解決這個問題?我是 HTML 和 Node.js 編程的新手。我試過了,但比我想象的要難
<!-- 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 class="full">
<header id="top" class="header">
<div class="col-md-6 col-md-offset-3 panel panel-default">
<div class="text-vertical-center">
<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" class="btn btn-dark btn-lg">Click Here!</a>
</div>
</div>
</header>
<% include ../partials/footer %>
`
匯出錯誤
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\ejs@3.1.8\node_modules\ejs\lib\ejs.js:673:12)
at Object.compile (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\ejs@3.1.8\node_modules\ejs\lib\ejs.js:398:16)
at handleCache (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\ejs@3.1.8\node_modules\ejs\lib\ejs.js:235:18)
at tryHandleCache (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\ejs@3.1.8\node_modules\ejs\lib\ejs.js:274:16)
at exports.renderFile [as engine] (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\ejs@3.1.8\node_modules\ejs\lib\ejs.js:491:10)
at View.render (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\express@4.18.2\node_modules\express\lib\view.js:135:8)
at tryRender (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\express@4.18.2\node_modules\express\lib\application.js:657:10)
at Function.render (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\express@4.18.2\node_modules\express\lib\application.js:609:3)
at ServerResponse.render (D:\hack\hacktoberfest-museum-main\node_modules\.pnpm\express@4.18.2\node_modules\express\lib\response.js:1039:7)
我試過這個也不起作用。
奇怪的是我嘗試 pnpm install 到要求但它不起作用。
uj5u.com熱心網友回復:
您的檔案參考不在引號中,它們需要是這樣的:
<% include "../partials/header" %>
此外,您似乎使用了錯誤的語法進行評論。由于這是一個.erb檔案,而不是.html您需要使用的檔案:
<%# commented line %>
而不是<!-- ... -->.
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/525202.html
標籤:节点.js表示
