Cannot start node server, issue with mongodb database?
<p>I am trying to follow this <a href="https://blog.udemy.com/node-js-tutorial/#0" rel="nofollow noreferrer">tutorial</a>, I cannot run the node server because of this error :</p>

<blockquote>
  <p>TypeError: Cannot read property 'name' of undefined
      at makeSkinClass </p>
</blockquote>

<p>Here is my path :</p>

<blockquote>
  <p>echo $PATH
  /usr/local/mysql/bin:/mongodb/bin:Users/Empon/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin</p>
</blockquote>

<p>I figured out that <code>-g</code> never works in my Terminal, so I tried to add the paths to the PATH permanently, I added mongodb to both bashrc, and bash_profile.</p>

<p>Then I did <code>npm install -g mongodb</code>, I had this :</p>

<blockquote>
  <p>mongodb-core@1.2.32 requires a peer of kerberos@~0.0 but none was
  installed.</p>
</blockquote>

<p>So I added <code>npm install --save kerberos mongodb</code> and the result was :</p>

<blockquote>
  <p>npm WARN skippingAction Module is inside a symlinked module: not
  running remove bson@0.4.21 node_modules/mongodb/node_modules/bson npm
  WARN skippingAction Module is inside a symlinked module: not running
  remove core-util-is@1.0.2</p>
</blockquote>

<p>Now, in my Node project, I do : <code>node bin/www</code> to start the server (I tried node app.js, with "app.js" in the config file, but it did not work, so I let <code>./bin/www</code>), and the url is : <code>http://localhost:3000/api/videos</code>.</p>

<p>Would you know what is wrong?</p>

<hr>

<p>EDIT:
I got it working, with these manipulations : installing an older version of mongodb and changing a line in a config file :</p>

<p><a href="https://stackoverflow.com/questions/29804321/does-run-mongoskin-only-with-mongodb-version-1-4-and-older">Does run mongoskin only with mongodb version 1.4 and older?</a></p>

<p><a href="https://stackoverflow.com/questions/28651028/cannot-find-module-build-release-bson-code-module-not-found-js-bson">Cannot find module &#39;../build/Release/bson&#39;] code: &#39;MODULE_NOT_FOUND&#39; } js-bson: Failed to load c++ bson extension, using pure JS version</a></p>

<p>I am almost there, the url to the port works fine (<a href="http://localhost:3000/" rel="nofollow noreferrer">http://localhost:3000/</a>), but not the one for mongodb (<a href="http://localhost:3000/api/videos" rel="nofollow noreferrer">http://localhost:3000/api/videos</a>), the error is :</p>

<blockquote>
  <p>Error: Not Found
      at /Applications/MAMP/htdocs/workspace/Vidzy/app.js:32:13
      at Layer.handle [as handle_request] (/Applications/MAMP/htdocs/workspace/Vidzy/node_modules/express/lib/router/layer.js:95:5)
      at trim_prefix (/Applications/MAMP/htdocs/workspace/Vidzy/node_modules/express/lib/router/index.js:312:13)</p>
</blockquote>

<p>And my code is :</p>

<pre><code>//in routes/video.js
var express = require('express');
var router = express.Router();
var monk = require('monk');
var db = monk('localhost:27017/vidzy');

router.get('/', function(req, res){
    var collection = db.get('videos');
    collection.find({}, function(err, videos){
       if (err) throw err;
       res.json(videos);
    });
});
module.exports = router;


//in app.js
// catch 404 and forward to error handler
app.use(function(req, res, next) {
  var err = new Error('Not Found');
  err.status = 404;
  next(err);
});
</code></pre>

<p>The Terminal is connected to mongoDB : </p>

<blockquote>
  <p>I NETWORK  [initandlisten] waiting for connections on port 27017</p>
</blockquote>

<p>Would someone know why I get a 404, and how to debug this?</p>