gjw80
gjw80

Reputation: 1078

Sails.js app can't see index.ejs?

Going through a nettuts tutorial on sails.js and am having problems displaying my index.ejs file. I created the index.ejs file under views\main\, but when I run the app with sails lift it's saying:

{
  "status": 500,
  "errors": [
    "Failed to lookup view \"main/index\""
  ]
}

in the browser. I checked several time and everything appears to be named correctly and placed in the correct directories. I'm using node.js v0.10.20 and sails v0.9.7.

Upvotes: 1

Views: 1174

Answers (2)

Melvin
Melvin

Reputation: 6008

I think this is an issue for Sails 0.9.7... GitHub Issue

For now I think you could revert back to 0.9.4

npm remove sails -g
npm cache clear
npm install [email protected] -g

Upvotes: 0

athula
athula

Reputation: 31

Open this file in a text editor

C:\Documents and Settings\\Application Data\npm\node_modules\sails\lib\express\views.js

in line 10 change as below

//return glob.sync(path, {nocase: true});

return glob.sync(basename (path), {cwd: dirname (path), nocase: true});

in line 28

//if (exists(path)) return globPath(path)[0];

if (exists (path)) return path;

in line 33

//if (exists(path)) return globPath(path)[0];

if (exists (path)) return path;

Upvotes: 3

Related Questions