Report this

What is the reason for this report?

How To Install Express, a Node.js Framework, and Set Up Socket.io on a VPS...Part 4: The Server Code

Posted on March 2, 2016

Following the tutorial mentioned above, part 4, rewriting app.js, I get this error, any suggestion on how to correct it? /root/socketio-test/app.js:9 var app = express(); ^ TypeError: object is not a function at Object.<anonymous> (/root/socketio-test/app.js:9:11) at Module.compile (module.js:456:26) at Object.Module.extensions…js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:902:3



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

express() can be used to create a server in express 3.x.x but in earlier versions the command would be

var app = express.createServer();

That would be the most common reason for the issue you’re seeing. The other possibility is that express was not installed properly via npm, re-doing the install may correct this if changing the express() call does not.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.