Skip to content


Windows "Failed to lookup view "home/index"" #983

adifah opened this Issue · 61 comments

Problem occurs on Win7 with sails.js 0.9.7 (0.9.4 is working fine). Node version is 0.10.20.

steps to reproduce:

npm install -g sails
sails new app
cd app
sails lift

if you visit http://localhost:1337/ you will get the following error:

  "status": 500,
  "errors": [
    "Failed to lookup view \"home/index\""

can someone confirm that?


same here on my test machine (windows 7, node 0.10.7). sails 0.9.4 works fine too.

sails 0.9.7 on a osx machine is working.


Seeing the same here. Reverted to 0.9.4 and it works.


me too.

just in case anyoneelse is wondering how to revert sails to an older version:

npm remove sails -g
npm install sails@0.9.4

Balderdash member

Thanks for reporting guys- I'll look into it asap. It's a backslash thing


I am having this problem too with this version. I will try to revert to 0.9.4 for now.


got similar error on redhat's openshift, had to revert to 0.9.4

glob error { [Error: EACCES, permission denied '/var'] errno: 3, code: 'EACCES', path: '/var', syscall: 'readdir' }
error: Error rendering view at :: /var/lib/openshift/xxx/app-root/runtime/repo/views/home/index
error: Using layout located at :: /var/lib/openshift/xxx/app-root/runtime/repo/views/layout
error: Server Error (500)
error: Error: Failed to lookup view "home/index"


I was happy that a new version of sails.js was available (0.9.7). Unfortunately, I had the same problem as you and worse I did not want to go through 0.9.4 and so I had only one choice is to find a solution. Done and that took me all afternoon and I share with you and j'èspère what would be integrated quickly.

Must be modified in the file "sails \ lib \ express \ view.js"

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

line # 28
/ / if (exists (path)) return globpath (path) [0];
if (exists (path)) return path;

line # 33
/ / if (exists (path)) return globpath (path) [0];
if (exists (path)) return path;

@fyockm fyockm added a commit to fyockm/sails that referenced this issue
@fyockm fyockm #983 fix as recommended by @fjirari 198bfd1

From what I can tell, the basic problem is that the "glob" module only supports forward slash on windows, and that breaks the paths. Looks like lib/express/view.js was created to enable case-insensitive view lookups. Perhaps this approach must be rethought.


I had the same problem. I ended up installing a vhost of ubuntu and installed sails from there. The problem was not present in ubuntu, but interestingly, after copying the project folder to my windows 7 pc and running sails lift, all was well. It seems to be something that happens during install on windows 7.


create a pull request please


Should be worth mentioning that I can make views accessible using the above code change, but referenced CSS files within my assets directory then no longer work.

I guess that's because of this underlying issue with glob?


@michapixel I think that is exactly what I posted in PR #1012 a couple days ago. It breaks the mocha/Travis test.


:+1: I have same problem on ubuntu 12.04

Balderdash member

Thanks again everyone, we're looking into this now

Balderdash member

Fix seems to be good to go-- thanks @fjirari and @michapixel!

Pushed to associations branch: 74d0cfc
If it's good after a bit more testing, we'll do a hot fix for 0.9.7 asap


@mikermcneil did you read what @fyockm wrote about the mocha-test?


@mikermcneil @michapixel see travis log from my pull request #1012


0 down vote

I have same problem in Window 8. I solved this problem by following given steps.

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;


@SachinBaniya I think that change is done in 74d0cf by @mikermcneil.

If it works on Windows 8, add a comment to that commit indicating so.


This issue is still live, any updates? Sails 9.7 is unusable right now.


@darth10 I tested this changes on Windows 8.1 and left a comment. It is working well for me!


Just in case, I've just installed sails with
$ npm -g install sails
and the problem is still present (I'm under Windows 7)
A workaround, proposed by @fjirari, helped


Ditto here, just installed (npm -g install sails) about an hour ago and problem is still present.


@Malgin @osswe This fix isn't part of the release build yet. It will be released soon IMHO.


SachinBaniya's comment worked for me, except my sails directory is in C:\Users\Aaron\AppData\Roaming\npm\node_modules\sails


Hi adifah,
I confirm it. I get the following error in Win7 at http://localhost:1337/:
"status": 500,
"errors": [
"Failed to lookup view \"home/index\""


I had the same problem on Win 7 (not in Mac).
Solved locally by changing the views.js file with SachinBaniya´s fixes.


I installed sails 0.9.7 yesterday. I had the same problem. I applied the fix above but no change. Still have the problem. I am still on Windows XP.


Thanks, I will try that. I went the remove .9.7 and install 9.4. That worked now let me try to go back to 9.7

0.9.7 works once I modified the global and in the project folder too.


@SachinBaniya Thanks it works.. (y)


Thanks @SachinBaniya -- That fixed it.


Thanks! Up and running (Win 7 64 bits).


It would be awesome if someone could pull this change into the main module


Things seem to be moving a bit slow for the last few months.. I mean: this issue is breaking and was reported over 6 weeks ago. I wonder what's up with the core team.


I agree @yoshuawuyts. Maybe they just don't care about Windows devs


@ZECTBynmo I think they care about everything, but right now are covered so deeply requests that they've smply become stuck. The community doesn't have the proper channels to ventilate their questions, so they just dump everything into GitHub issues, making it a thick forest in which you'll be discouraged to look. If only they communicated their plans, timeline and channels better, things would rapidly improve.


The comment from @SachinBaniya worked for me on Windows 7 too.


Same error here, fresh install on Windows 7:

"status": 500,
"errors": [
"Failed to lookup view \"home/index\""


+1 but @SachinBaniya comment worked.


Wow, this is a major issue, sadly some of us have to work on windows machines. The solution proposed by @SachinBaniya works great.


This solution initially worked for me, but upon changing the templating engine to hogan the behavior returned and it broke down again. Easily testable: I only changed the views.js engine to 'hogan'.


This is still an issue in master and the supposed fix in the associations branch is missing/does not fix problem.


The comment from @SachinBaniya fixed problem on Windows 8. Sails v0.9.7


@SachinBaniya's comment fixed the problem until I tried using a different templating engine, specifically Jade. Win7, Sails v0.9.7.


I'm getting the same error using the enviroment. I'm using this version: v0.9.7


@shlomifruchter Remove your current version of sails than install the version 0.9.4.


Just test the comment from yogleputra8, and it works. Thx.


me too, windows7 sails v0.9.7


Same here, on Windows 8

@damassi damassi pushed a commit that referenced this issue
@mikermcneil mikermcneil Potential resolution for #983 74d0cfc

@mikermcneil is "99% sure this is fixed on v0.10 branch" but doesn't have a Windows box set up to test. Could one of the many commenters try the new branch and report back?


I tried it briefly, and it appears that creating new projects is broken in v0.10. Whenever I type "sails new testProject" it says it created a new app in the appropriate directory, but nothing actually happens. There are no files/folders generated, and no error messages.

@devel-pa devel-pa added a commit to devel-pa/sails that referenced this issue
@devel-pa devel-pa mvc modularity
(also fixed view issue on windows #983)

I pretty much wanted to check Sails out, but above happens. I tried to install 0.9.4, but still the same. Anyone had the same issue?
I did
npm uninstall sails
npm install -g sails@0.9.4

when i type npm list, I get:
npm ERR! missing: sails@0.9.7, required by test@0.0.0 after creating a new project

Balderdash member

@ZECTBynmo haven't finished sails new refactor in 0.10, but I'm pretty close.

@czapeczek maybe try sudo npm uninstall -g sails && sudo npm install -g sails@0.9.4? (if you're on windows, you can drop the sudo) Also, you'll want ot make sure an remove the local dep. if you're trying to lift an existing app, i.e. rm -rf node_modules/sails


my solution was to change in lib / express / view.js, line 10 like:

   return glob.sync(path, {nocase: process.platform !== 'win32'});
Balderdash member

Will be included in hotfix on master:

Balderdash member

npm install sails@beta will grab the soon-to-be-released v0.9.8 with a fix for this. Thanks for your help/patience, guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.