Hello, I tried activating app.js and it works, but when I tried to access my localhost: 5000, it happened
SyntaxError: Unexpected identifier in /Users/apple/Documents/NodeJS/views/index.ejs while compiling ejs
If the above error is not helpful, you may want to try EJS-Lint: github.com/RyanZim/EJS-Lint
Or, if you meant to create an async function, passasync: trueas an option.
at new Function ()
at Template.compile (/Users/apple/Documents/NodeJS/node_modules/ejs/lib/ejs.js:626:12)
at Object.compile (/Users/apple/Documents/NodeJS/node_modules/ejs/lib/ejs.js:366:16)
at handleCache (/Users/apple/Documents/NodeJS/node_modules/ejs/lib/ejs.js:215:18)
at tryHandleCache (/Users/apple/Documents/NodeJS/node_modules/ejs/lib/ejs.js:254:16)
at View.exports.renderFile as engine
at View.render (/Users/apple/Documents/NodeJS/node_modules/express/lib/view.js:135:8)
at tryRender (/Users/apple/Documents/NodeJS/node_modules/express/lib/application.js:640:10)
at Function.render (/Users/apple/Documents/NodeJS/node_modules/express/lib/application.js:592:3)
at ServerResponse.render (/Users/apple/Documents/NodeJS/node_modules/express/lib/response.js:1012:7)
SyntaxError: Unexpected identifier in /Users/apple/Documents/NodeJS/views/index.ejs while compiling ejs
I'm a software developer who loves tackling problems for various solutions amongst multiple stacks. I love writing clean, scalable and extremely well-commented code. Working with different teams is fu
Hello, I tried activating app.js and it works, but when I tried to access my localhost: 5000, it happened
SyntaxError: Unexpected identifier in /Users/apple/Documents/NodeJS/views/index.ejs while compiling ejs
If the above error is not helpful, you may want to try EJS-Lint:
github.com/RyanZim/EJS-Lint
Or, if you meant to create an async function, passasync: trueas an option.
at new Function ()
at Template.compile (/Users/apple/Documents/NodeJS/node_modules/ejs/lib/ejs.js:626:12)
at Object.compile (/Users/apple/Documents/NodeJS/node_modules/ejs/lib/ejs.js:366:16)
at handleCache (/Users/apple/Documents/NodeJS/node_modules/ejs/lib/ejs.js:215:18)
at tryHandleCache (/Users/apple/Documents/NodeJS/node_modules/ejs/lib/ejs.js:254:16)
at View.exports.renderFile as engine
at View.render (/Users/apple/Documents/NodeJS/node_modules/express/lib/view.js:135:8)
at tryRender (/Users/apple/Documents/NodeJS/node_modules/express/lib/application.js:640:10)
at Function.render (/Users/apple/Documents/NodeJS/node_modules/express/lib/application.js:592:3)
at ServerResponse.render (/Users/apple/Documents/NodeJS/node_modules/express/lib/response.js:1012:7)
SyntaxError: Unexpected identifier in /Users/apple/Documents/NodeJS/views/index.ejs while compiling ejs
I believe you tried an include but you may have written it bad. Try to write it like this:
<%- include ("../fragments/header") %>
Same error here. Any fix for this?
Inside index.ejs file add this in line 1:
<%- include("partials/header") -%>