bradtraversy / node_passport_login

Node.js login, registration and access control using Express and Passport
1.74k stars 1.29k forks source link

Help me: <% include ./partials/messages %> error..Why? #52

Open NuPhan123 opened 4 years ago

NuPhan123 commented 4 years ago

image

i cant register

joelruizcabrera commented 4 years ago

I have the same problem...

zykovmv commented 4 years ago

image

i cant register

you should do this: <% include ('partials/messages') %>

zykovmv commented 4 years ago

I have the same problem...

Please try this: <% include ('partials/messages') %>

zebmastah commented 4 years ago

I have the issue too, <% include ('partials/messages') % resolves the error but won't fix it. The errors won't display as his tutorial show.

zebmastah commented 4 years ago

I have the issue too, <% include ('partials/messages') % resolves the error but won't fix it. The errors won't display as his tutorial show.

It did work, however you have to keep the hyphen in the code like so: <%- include ('partials/messages') %>

vigneshrathnam commented 4 years ago

<%- include ('partials/messages') %> include hyphen in the statement

lkarjun commented 4 years ago

<%- include ('partials/messages') %> include hyphen in the statement

is not working

MdYusufBinNur commented 4 years ago

<%- include('partials/messages') %> worked for me

kenwaysharma commented 4 years ago

I have the same problem. None of the solutions work.

hackrx commented 4 years ago

Same issue here <%- include('partials/messages') %> is not working for me it showing the same error

hackrx commented 4 years ago

Guys use this it wroked for me <%- include ('./partials/messages'); %> I think newer version on ejs supports this format. Don't forget to add -(hyphen) in beg. and a semicolon ;

kiranmurali93 commented 4 years ago

Guys use this it wroked for me <%- include ('./partials/messages'); %> I think newer version on ejs supports this format. Don't forget to add -(hyphen) in beg. and a semicolon ;

It didn't work for me so what I did was instead of making a separate file for messages I replaced <%- include ('./partials/messages'); %> with the contents in message.ejs

sikander804 commented 4 years ago

Guys use this it wroked for me <%- include ('./partials/messages'); %> I think newer version on ejs supports this format. Don't forget to add -(hyphen) in beg. and a semicolon ;

It didn't work for me so what I did was instead of making a separate file for messages I replaced <%- include ('./partials/messages'); %> with the contents in message.ejs

still not working.

ghost commented 4 years ago

not working still.. it says success_msg is not defined

ghost commented 4 years ago

Ok guys, I was receiving the exact same error message an hour ago and just got it to work. To fix the first error, you have to go <%- include("partials/messages") -%> To fix the success_msg is not defined error, make sure your router, app.use('/', require('./routes/index.js')); and app.use('/users', require('./routes/users.js'));, is below app.use(flash()) like how Brad has it in the repo. If you're getting an error message like req.flash() is not a function, changing the router position is also the fix. Hope this helped

P-oke commented 4 years ago

This worked for me

<%- include("partials/messages") %>

eidan66 commented 4 years ago

Same issue here <%- include('partials/messages') %> is not working for me it showing the same error

you need write like this : <%- include ('./partials/messages') %> you miss the -- > './' before partials

NuPhan123 commented 4 years ago

Thank you very much ^^

T.Null

Vào 18:28, Th 5, ngày 13 tháng 8 năm 2020 eidan66 notifications@github.com đã viết:

Same issue here <%- include('partials/messages') %> is not working for me it showing the same error

you need write like this : <%- include ('./partials/messages') %> you miss the -- > './' before partials

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bradtraversy/node_passport_login/issues/52#issuecomment-673422434, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANP4NSC2UQBSPIGDVI7EQV3SAPE6RANCNFSM4JBBXCYA .

najimali commented 4 years ago

@NuPhan123 To fix this error you need to understand why it is happening

Some Error Reason;

  1. View engine may not be set Solution - app.set("view engine", "ejs"); add this in server.js file
  2. The path is not correct Solution - Check your folder structure dot-slash (./) means you are pointing to the current directory so I am assuming your register template is views directory & message.ejs file in partials directory then the path will be ./partials/message if your register template is in views/user directory then use double dot to move one directory backward ../partials/message
  3. Syntax error - correct syntax is <%- include("file_path"); -%>
sattu444 commented 3 years ago

just use this <%- include ./partials/messages %>

Hope this worked...

sania-iftikhar commented 3 years ago

Use this syntax , It will work <%- include ("./partials/messages"); %>

alexeystardev commented 3 years ago

Try <% include ./partials/messages %> for me works.

blackhoole commented 3 years ago

I have the same problem ,and i have tried almost all the solution above, such as <% include ./partials/messages %> <%- include ("./partials/messages"); %> <%- include('./partials/messages'); %> , but none of them work. and finally i realized its not about the include statement , it's about the messages.ejs there is some grammer mistake that i made in the messages.ejs ,after correct that grammer error, things get work

kushwahasanket commented 3 years ago

probably you have not included partials .. you can show your file structure ..or just delete <% include ./partials/messages %> this line from both login and register file it will work . but no css will be included

myworldbox commented 3 years ago

The error is the blank space after the include go to views > partials > register.js and change <%- include ("./partials/messages"); %> to <%- include("./partials/messages"); %>

Joshua-Coded commented 2 years ago

thanks for all the solutions provided above, <%- include("./partials/messages"); %> this worked for me.

odysseus1999 commented 1 year ago

Use this syntax , It will work <%- include ("./partials/messages"); %>

thanks it helped.