Reputation: 169
I am developing a web app using reactjs and nodejs technologies and after that, I deployed it on HEROKU, but when I run on Heroku it gives me an error ENOENT: no such file or directory, stat '/app/client/build'" and I observe one thing stat '/app/client/build' this path not change at anytime I dont know why because I am a new learner in reactjs and nodejs.
server.js
var restify = require("restify");
var server = restify.createServer();
function respond(req, res, next) {
res.send('Hello Restify!');
}
server.get('/hello', respond);
server.get("/*", restify.plugins.serveStatic({
directory: __dirname+"/client/build",
default: 'index.html',
appendRequestPath: false
})
);
var port = process.env.PORT || 5000;
server.listen(port, function() {
console.log("Listening on " + port);
});
Upvotes: 0
Views: 3719
Reputation: 11
The reason why this might be erroring out is because the /client/build
directory might not exist.
git add
you are including this folder (i.e maybe you have .gitignore
file that is excluding this directoryheroku run bash # should take you to the current dyno's bash
ls # do you see your client directory?
cd client
ls # do you see your build directory?
Upvotes: 1