500 Error: ENOENT, open 'C:\Users\Gilbert\Documents\GitHub\maths4me\base.dust' with consolidate.js
Asked Answered
P

4

6

I get this error when trying to set up inheritance in dust.js:

500 Error: ENOENT, open 'C:\Users\Gilbert\Documents\GitHub\maths4me\base.dust'

I have a file called index.html:

{>"base.dust"/}
   {<title}Hi{/title}

Which calls base.dust:

<!DOCTYPE html>
<html>
  <head>
    <title>{+title}Maths 4 me{/title}</title>
    <link rel='stylesheet' href='/stylesheets/style.css' />
  </head>
  <body>
    <h1>Hi</h1>
    <p>Welcome to maths4me</p>
  </body>
</html>
Paynim answered 31/8, 2012 at 0:3 Comment(1)
need more info - how did you compile the two template files? because you may be referencing the partial wrong, but I can't be sure until I know moreAnthill
P
0

Dust partials look in the app root not the views folder, It took me some time to realise this. I was referencing a file in the wrong folder. My code should have been:

{>"/views/base.dust"/}
{<title}Hi{/title}
Paynim answered 23/9, 2012 at 11:12 Comment(2)
does not work for me: 500 Error: ENOENT, open '/views/base.dust'Epsilon
{>"views/base.dust"/} this works. forward slash causes error.Epsilon
F
3

ENOENT means that file doesn't exist.

Check again that base.dust exists in provided location.

Frigorific answered 10/9, 2012 at 2:14 Comment(0)
P
0

Dust partials look in the app root not the views folder, It took me some time to realise this. I was referencing a file in the wrong folder. My code should have been:

{>"/views/base.dust"/}
{<title}Hi{/title}
Paynim answered 23/9, 2012 at 11:12 Comment(2)
does not work for me: 500 Error: ENOENT, open '/views/base.dust'Epsilon
{>"views/base.dust"/} this works. forward slash causes error.Epsilon
M
0

If you like me don't want to specify full paths to base templates and partials all the time, try out: klei-dust. (it's like consolidate but only for dustjs-linkedin) In your scenario above you could just specify:

{>base/}

Instead of:

{>"views/base.dust"/}

...to get it to work.

Maharashtra answered 27/9, 2012 at 10:26 Comment(0)
O
0

Double check your names of your files. For me, I have seen this error Error: ENOENT, and I noticed that in one my main app.js, I wrote

app.get('/', function(req, res) {
    res.sendfile('./views/plan.html');
});

when I in views folder,I renamed it to home.html, This error appears accordingly

Orthognathous answered 26/11, 2013 at 2:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.