Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Build a Simple Dynamic Site with Node.js Creating a Basic Template Engine in Node.js Reading from Files

Sean Flanagan
Sean Flanagan
33,233 Points

Error message in console

Hi.

I got as far as 13 minutes 43 seconds into the video.

I run the server, preview it, open Port 3000, and the workspace is unavailable. In the console, I get this message:

Server running at http://<workspace-url>/                                                                 
fs.js:641                                                                                                 
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);                            
                 ^                                                                                        

Error: ENOENT: no such file or directory, open './views/search.html'                                      
    at Error (native)                                                                                     
    at Object.fs.openSync (fs.js:641:18)                                                                  
    at Object.fs.readFileSync (fs.js:509:33)                                                              
    at Object.view (/home/treehouse/workspace/renderer.js:5:25)                                           
    at Object.home (/home/treehouse/workspace/router.js:11:14)                                            
    at Server.<anonymous> (/home/treehouse/workspace/app.js:8:10)                                         
    at emitTwo (events.js:106:13)                                                                         
    at Server.emit (events.js:191:7)                                                                      
    at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:546:12)                               
    at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)

Here's my workspace:

https://w.trhou.se/edv4wbs24c

I'd appreciate any help please.

1 Answer

Seth Kroger
Seth Kroger
56,407 Points

You mistakenly gave the HTML file a .js extension instead of .html so the name is wrong. (I also noticed you're missing an openint < on the image tag in that file as well.)

Sean Flanagan
Sean Flanagan
33,233 Points

Hi Seth. I added the missing opening tag and changed the file extension. Well spotted. I've upvoted you and given you Best Answer. Thank you. :-)