Error: Failed to lookup view in Express
npm install [email protected]
installs the previous version, if it helps.
I know in 3.x the view layout mechanic was removed, but this might not be your problem. Also replace express.createServer()
with express()
Update:
It's your __dirname from environment.js
It should be:
app.use(express.static(__dirname + '../public'));
Adding to @mihai's answer:
If you are in Windows, then just concatenating __dirname' + '../public'
will result in wrong directory name (For example: c:\dev\app\module../public
).
Instead use path
, which will work irrespective of the OS:
var path = require ('path');
app.use(express.static(path.join(__dirname + '../public')));
path.join will normalize the path separator character and will return correct path value.