This is my repository on Github-> https://github.com/melbourne2827/Budgtr
I’ve been trying to deploy this project using the “new web service” option on Render.com. I set the build command as npm install, start command as node app.js and set the environment variable for DB_URL (Mongo DB Atlas Database Used). This project runs perfectly well on my localhost. But I end up getting this error from render
ReferenceError: views/layouts/boilerplate.ejs:16
Apr 26 06:55:57 PM 14|
Apr 26 06:55:57 PM 15|
Apr 26 06:55:57 PM >> 16| <%- include(‘…/partials/navbar’) %>
Apr 26 06:55:57 PM 17|
Apr 26 06:55:57 PM 18| <%-include(‘…/partials/flash’) %>
Apr 26 06:55:57 PM 19| <%- body %>
/opt/render/project/src/views/partials/navbar.ejs:9
Apr 26 06:55:57 PM 7|
Apr 26 06:55:57 PM 8|
Apr 26 06:55:57 PM >> 9| <% if(currentUser){ %>
Apr 26 06:55:57 PM 10|
Apr 26 06:55:57 PM 11| analytics
Apr 26 06:55:57 PM 12|
currentUser is not defined
This is how the navbar file looks like
<% if(currentUser){ %>
<li class="nav-item">
<a class="nav-link" href="/analytics">analytics</a>
</li>
<% } %>
</ul>
<ul class="navbar-nav ml-auto">
<% if(!currentUser){ %>
<li class="nav-item active">
<a class="nav-link" href="/login">login</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="/register">Register</a>
</li>
<% } else{ %>
<li class="nav-item active">
<a class="nav-link" href="/logout">logout</a>
</li>
<% } %>
</ul>
It checks if a user is logged in, It’ll show the analytics and logout option, If you’re not logged in, it shows the Login & Register Option
I get no kind of error for currentUser when I run it in my localhost and the website runs as expected. Could you tell me what might be going wrong in this?
Also maybe do suggest an alternative to Render.com where I can deploy this project?
Thanks a ton!
user24780194 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.