npm install won’t install devDependencies

Check the NPM docs for install With the –production flag (or when the NODE_ENV environment variable is set to production), npm will not install modules listed in devDependencies.” The –only={prod[uction]|dev[elopment]} argument will cause either only devDependencies or only non-devDependencies to be installed regardless of the NODE_ENV.” Have you tried npm install –only=dev If you are … Read more

Purpose of installing Twitter Bootstrap through npm?

If you NPM those modules you can serve them using static redirect. First install the packages: npm install jquery npm install bootstrap Then on the server.js: var express = require(‘express’); var app = express(); // prepare server app.use(‘/api’, api); // redirect API calls app.use(“https://stackoverflow.com/”, express.static(__dirname + ‘/www’)); // redirect root app.use(‘/js’, express.static(__dirname + ‘/node_modules/bootstrap/dist/js’)); // … Read more

MongoDB – Error: getMore command failed: Cursor not found

EDIT – Query performance: As @NeilLunn pointed out in his comments, you should not be filtering the documents manually, but use .find(…) for that instead: db.snapshots.find({ roundedDate: { $exists: true }, stream: { $exists: true }, sid: { $exists: false } }) Also, using .bulkWrite(), available as from MongoDB 3.2, will be far way more … Read more

Mongoose Schema hasn’t been registered for model

It’s not an issue with model export. I had the same issue. The real issue is that require statements for the models var mongoose = require(‘mongoose’); mongoose.connect(‘mongodb://localhost/news’); require(‘./models/Posts’); require(‘./models/Comments’); were below the routes dependencies. Simply move the mongoDB dependencies above the routes dependencies. This is what it should look like: // MongoDB var mongoose = … Read more

Error installing bcrypt with npm

The easy solution is just switch from the “bcrypt” npm module to bycryptjs or bcrypt-nodejs. It’s the exact same API, but pure JS so no native add-ons to deal with. npm install –save bcryptjs && npm uninstall –save bcrypt Then change your require calls to “bcryptjs”, but all your code otherwise can be unchanged. Long … Read more