在跟随cnode社区,一起学习node.js 过程中,进行到课程第四节用ejs渲染注册页面的时候遇到了一些问题。 signup.ejs如下
<%- include('header') %>
请求 localhost:3000/signup时,引擎在去渲染视图时,控制台报错
SyntaxError: C:\Users\ct\Documents\mycode\nodestudy\formalblog\views\signup.ejs:1
>> 1| <%- include('header') %>
2|
3|
4|
C:\Users\ct\Documents\mycode\nodestudy\formalblog\views\header.ejs:13
11|
12| <%- include('components/nav') %>
>> 13| <%- include('components/nav-setting') %>
14| <%- include('components/notification') %>
15|
Unexpected token if in C:\Users\ct\Documents\mycode\nodestudy\formalblog\views\components\nav-setting.ejs while compiling ejs
很奇怪的语法错误,我的node 版本是v7.2.0, ejs版本是2.5.6,我也查看了相应版本的文档,这样Include应该没有问题,同时,相应路径下的文件也是存在的。所以不清楚为什么会报这样的错误。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
走同样的路,发现不同的人生