Rendering issue nodejs

Good morning,

I finally decided to give nodejs a try instead of my usual php projects and everything was going great until suddenly, the page started rendering incorrectly.

Perhaps it has something to do with this missing file “ENOENT: no such file or directory, open ‘/opt/node_app/views/vendor.ejs’\n” that I did indeed delete and I also deleted it’s route reference, but it didn’t start happening right away after I deleted it. Also, I can’t find where it’s still referencing the file in the code.

Like I said I’m new to nodejs so not sure how the references to pages, layouts etc work, nor where the routes are stored cause there doesn’t appear to be an .htaccess/routes.json file in nodejs.

Thanks in advance,
Twitch

As far as I know, routes are stored on a routes.json file
Can you show more screenshots about the structure of the app?

@franse, you are correct, I finally found the routes.json file. It’s in a different place in nodejs than I’m used to in PHP, but everything looks fine with the routes file. I’ll try and post more when I get a chance. It was weird cause it was working fine and then suddently wasn’t.

Great! 3 friendly suggestions:

  1. Post the error code like: https://community.wappler.io/t/how-to-format-code-in-your-posts/19828
    So more people can inspect, as it’s hard to see from a picture (especially for those who are on a cellphone)
  2. If you’re on local, check the console:
  3. If the site is on a live server, check if your files are up to date on the remote directory
1 Like

Thanks for your suggestions @franse

If I look in console of the browser, I do get this error about the vendor.ejs which is true, I did delete the vendor.ejs file and the route associated with it, however, I can’t find where it’s trying to reference the file on the main.ejs file or find the “opt” folder. It’s showing that it’s after the bootstrap script at the end of the body tag, but not sure why.

Part of the console error:
'\n 339| <script src="/bootstrap/5/js/bootstrap.bundle.min.js">\n\nENOENT: no such file or directory, open ‘/opt/node_app/views/vendor.ejs’",

Part of code at the end of the body tag:

<div is="dmx-view" id="content">
    <%- await include(content, locals); %>
  </div>
  <footer class="fixed-bottom"><span class="navbar-text p-2 d-none d-sm-block d-md-block small text-center">© Copyright 2023 | <a href="https://www.arn.com" style="text-decoration:none;" dmx-style:color="varPrimaryColor.value">ARN</a> | All Rights Reserved</span></footer>
  <script src="/bootstrap/5/js/bootstrap.bundle.min.js"></script>
</body>

</html>

@patrick any idea why and where it’s referencing that file still?

Thanks in advance,
Twitch

May I suggest you open your Wappler project in Visual Studio Code and use the search in all files functionality to search for any references to “vendor.ejs”?

Good advice, but (sorry, slightly off-topic) I’m curious: why would you switch to VSC to search? I frequently use Wappler’s built-in search facilty when looking for references to filenames/code etc. It seems to work very well and is fast. Obviously, you have to make sure the exclusions are set up as you want.

1 Like

Thanks for the reply, @Apple. I have used Wappler’s search to look for references and it didn’t find any. As TomD said, Wappler’s search has been very good in the past so I assumed it could find it but it comes up with nothing.

Oh, I wasn’t familiar with Wappler search :slight_smile: Glad it works good! I’ve been using VSCode before I’ve started using Wappler, so that’s the only reason I mentioned it

It’s a great feature. After the initial search, it’s extremely quick - it shows a collapsible list of files, relevant line numbers and clickable links:

Here are some tips on using the File/directory pattern field

1 Like

I forgot to mention: keyboard shortcut - Ctrl+Shift+F (or Mac equivalent)

I believe I figured it out. It was in the route.json file after all. A search for vendor.ejs didn’t work because the extension (.ejs) is not in the route file. Should have known it was somthing simple… :man_facepalming:
{
“path”: “/:url_name”,
“page”: “vendor”,
“layout”: “main”
},

1 Like