Got this book recently and started working on the example and I hit a road block. Searched through the forums. Went through the internet. Not much success. I am not sure if the issue is because of node.js or because of permission on the OS.

Here is the problem statement
OS: Ubuntu Linux, installed on Virtual Box. Virtual Box is running on Win8.

Steps:
Login to Linux on Virtual box, through Cygwing client
Execute sudo npm install -g express@2.5.8 (pg. 7)
Execute express authentication (pg. 8)
Change directory cd authentication
Execute node app.js

Open the browser and type http://myVirtualBoxIPAddress:3000
and observe “Welcome to Express.” message displayed in the browser. So far so good. Everything seems to work just fine.

Now I come to page 12. Per the instruction, I create a directory under authentication folder and name the directory as "lib" using below command
[username@myUbuntu:~/sitepoint/authentication]$ mkdir lib

then create the db.js file using emacs. Save the file. Yes, I have setup the mongoDB on mongolab, tested the connection and everything works.

Then I create the Users.js file by below steps
[username@myUbuntu:~/sitepoint/authentication]$ mkdir models
[username@myUbuntu:~/sitepoint/authentication]$ cd models
[username@myUbuntu:~/sitepoint/authentication/models]$ emacs -nw Users.js



type in the code given on page 14 and save the file. My app.js looks like below
Code JavaScript:
 
var express = require('express') , routes = require('./routes') , fs = require('fs') , User = require('./models/User.js');


Now I try to run app.js from authentication folder and I get the below error


module.js:340
throw err;
^
Error: Cannot find module './models/User.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/username/authentication/app.js:10:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)


I have been struggling with this error for 2 days and have given up. If anyone knows what the solution may be, please help. This will be highly appreciated.

Thanks in advance,

Vinay