E: Unable to locate package npm

From the official Node.js documentation: A Node.js package is also available in the official repo for Debian Sid (unstable), Jessie (testing) and Wheezy (wheezy-backports) as “nodejs”. It only installs a nodejs binary. So, if you only type sudo apt-get install nodejs , it does not install other goodies such as npm. You need to type: Optional: install build tools … Read more

nodemon not working properly

You’re running express 4, which has the app.listen call in a different file than app.js. The command you’re looking for is nodemon bin/www (localhost and 3000 are not needed in this scenario). In fact, you can even run nodemon with no args, and it’ll read what command needs to be run from scripts.start in package.json (which express generates automatically).

Route.get() requires callback functions but got a “object Undefined”

In the tutorial the todo.all returns a callback object. This is required for the router.get syntax. From the documentation: router.METHOD(path, [callback, …] callback) The router.METHOD() methods provide the routing functionality in Express, where METHOD is one of the HTTP methods, such as GET, PUT, POST, and so on, in lowercase. Thus, the actual methods are router.get(), router.post(), router.put(), and so on. … Read more

http-server command not found

You may not have your npm binaries in PATH. Make sure that your npm binaries are in path by running echo $PATH. You should see, somewhere in the printed output, something like: /home/bob/.npm-packages/bin is the directory where my npm binaries are installed whenever I run npm -g install whatever. If you don’t see something like that, read Fixing npm permissions which … Read more

Cannot POST / error using express

This way you should try Things you should keep in mind for future Ref : You were extending url encode to true You were not having any get request for your form You were using HTML named variable which is one of bad practices Thanks & Cheers

db.collection is not a function when using MongoClient v3.0

I encountered the same thing. In package.json, change mongodb line to “mongodb”: “^2.2.33”. You will need to uninstall mongodb npm by removing MongoDB Driver/ node_modules or etc , then install npm to install this version. This resolved the issue for me. Seems to be a bug or docs need to be updated.

What does ESOCKET error mean when I’m trying to send an email?

Per https://github.com/nodemailer/nodemailer/issues/889#issuecomment-488267379 (and it’s follow-ups): same problem here. resolved it by using IP address as host, see https://nodemailer.com/smtp/#general-options For us it seems to be related to throttling as circa 140 messages go through in a batch while the remainder get this error (and all are being sent to the same email address, so no issue re: bad email … Read more

ExpressJS vs MeteorJS

Express = MVC Framework built in Javascript and is powered by Node. Meteor = Full Stack that has the front-end and back-end components to build a real-time application. To create the same implementation of Meteor using Express, you need to look at the MEAN stack, which includes MongoDB, Express, AngularJS, and Node. You can create … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)