'reference error:routes is not defined' in npm start

616 views Asked by At

I am a beginner in node.js and express and I have been following http://cwbuecheler.com/web/tutorials/2013/node-express-mongo/ as a reference to get started. I am building a small app to display data from my mongodb collection using jade.However,i get these errors in npm start.

> [email protected] start C:\node\nodetest1
> node ./bin/www

{ Error: Cannot find module '../build/Release/bson'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\node\nodetest1\node_modules\bson\ext\index.js:15:10)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3) code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
C:\node\nodetest1\app.js:50
app.use('/', routes);
             ^


ReferenceError: routes is not defined
at Object.<anonymous> (C:\node\nodetest1\app.js:50:14)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\node\nodetest1\bin\www:7:11)
at Module._compile (module.js:570:32)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node ./bin/www
enter code here`npm ERR! Exit status 1
enter code here`npm ERR!
enter code here`npm ERR! Failed at the [email protected] start script.
enter code here`npm ERR! This is probably not a problem with npm. There is likely additional code logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Admin\AppData\Roaming\npm-cache\_logs\2017-09-16T17_48_47_843Z-debug.log
PS C:\node\nodetest1>

I tried searching for the error in npm Official Docs but and even updated my npm to the latest version.But this is the latest set of errors I am getting.No Clues. Any help or hint would be highly helpful.

0

There are 0 answers