I ran the scotch.io tutorial to create my first node and angular application. I saw that relative paths are a common problem on the Internet for Error: ENOENT: no such file or directory, which, as far as I can tell, is the same as in the textbook, so for some reason I do not work.
Full error message:
Error: ENOENT: no such file or directory, stat'/Users/badman/githubRepos/travelGuide/app/public/index.html'
at Error (native)
My folder structure is here. My server.js:
var express = require('express');
var app = express();
var bodyParser = require("body-parser");
require('./app/routes.js')(app);
app.listen(3000, function() {
console.log("server going");
})
routes.js:
module.exports = function (app) {
app.get('*', function (req, res) {
res.sendFile(__dirname + '/public/index.html');
});
};
Any help is appreciated :)
source
share