Answer the question
In order to leave comments, you need to log in
Building a Router throws an error [TypeError: Cannot read property 'Kerberos' of undefined]. How to decide?
Good time of the day. i created the application using express test -e, zates created a file in the routes api.js directory with the content
var express = require('express');
var router = express.Router();
// start route
router.route('/devices')
.post(function(req, res) {
var device = new Device();
device.uuid = req.body.uuid;
device.location.coordinates = req.body.location.coordinates;
device.type = req.body.type;
device.save(function(err) {
if (err)
res.send(err);
res.json({ message: 'Device created!' });
});
})
.get(function(req, res) {
Device.find(function(err, devices) {
if (err)
res.send(err);
res.json(devices);
});
});
router.route('/devices/:device_id')
.get(function(req, res) {
Device.findById(req.params.device_id, function(err, device) {
if (err)
res.send(err);
res.json(device);
});
})
.put(function(req, res) {
Device.findById(req.params.device_id, function(err, device) {
if (err)
res.send(err);
device.uuid = req.body.uuid;
device.save(function(err) {
if (err)
res.send(err);
res.json({ message: 'Device updated!' });
});
});
})
.delete(function(req, res) {
Device.remove({
_id: req.params.device_id
}, function(err, device) {
if (err)
res.send(err);
res.json({ message: 'Successfully deleted' });
});
});
// end
module.exports = router;
var api = require('./routes/api');
var mongoose = require('mongoose');
mongoose.connect('mongodb://[email protected]:27017/monitor');
var Device = require('./models/device');
app.use('/api', api);
Answer the question
In order to leave comments, you need to log in
I have the same error, but it does not entail any consequences for me and the code works out. Node-inspector showed that it originates somewhere in the core of the mongodb driver used by mongoose. Accordingly, when we connect mongoose, then it pops up.
Here's what's in the driver readme:
## Troubleshooting
The MongoDB driver depends on several other packages. These are.
* mongodb-core
* bson
* kerberos
* node-gyp
The `kerberos` package is a C++ extension that requires a build environment to be installed on your system. You must be able to build node.js itself to be able to compile and install the `kerberos` module. Furthermore, the `kerberos` module requires the MIT Kerberos package to correctly compile on UNIX operating systems. Consult your UNIX operation system package manager what libraries to install.
{{% note class="important" %}}
Windows already contains the SSPI API used for Kerberos authentication. However you will need to install a full compiler tool chain using visual studio C++ to correctly install the kerberos extension.
{{% /note %}}
1.3.1 2016-02-05
----------------
- Removed annoying missing Kerberos error (NODE-654).
I wonder why there is such a difference between creating the base through the express generator and when you write everything with pens :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question