I am trying to follow this tutorial, I cannot run the node server because of this error :
TypeError: Cannot read property 'name' of undefined at makeSkinClass
Here is my path :
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
I figured out that -g
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.
Then I did npm install -g mongodb
, I had this :
mongodb-core@1.2.32 requires a peer of kerberos@~0.0 but none was installed.
So I added npm install --save kerberos mongodb
and the result was :
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
Now, in my Node project, I do : node bin/www
to start the server (I tried node app.js, with "app.js" in the config file, but it did not work, so I let ./bin/www
), and the url is : http://localhost:3000/api/videos
.
Would you know what is wrong?
EDIT: I got it working, with these manipulations : installing an older version of mongodb and changing a line in a config file :
Does run mongoskin only with mongodb version 1.4 and older?
I am almost there, the url to the port works fine (http://localhost:3000/), but not the one for mongodb (http://localhost:3000/api/videos), the error is :
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)
And my code is :
//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);
});
The Terminal is connected to mongoDB :
I NETWORK [initandlisten] waiting for connections on port 27017
Would someone know why I get a 404, and how to debug this?