This project is read-only.

http.createServer missing in intellisense

Dec 6, 2013 at 4:41 PM

I've installed the Node.js tools for VS 2012. I'm trying to follow along with a Pluralsight video Pluralsight node.js class

It's a fairly old video, so he's on version .1.something, I'm on v0.10.22. At any rate, the project he's trying to create is using code like the following:
var server = http.createServer
I don't see the createServer method (or the createClient method), even though it should be there according to the node.js documentation:

Node.js documentation

Am I missing something, or is this a "known issue" with Intellisense on the VS Node.js Tools?

Dec 6, 2013 at 6:04 PM
This should "just work" regardless of the Node version you're on (we have a hard coded list of the built-in modules such as http). What do you see after you type http. ? Do you see a list of completions with exclamation points in a yellow triangle?

The one thing I can think of is that the require call is messed up somehow, you should have entered something like:

var http = require('http');

Before doing the http.
Dec 6, 2013 at 6:19 PM

When I type http.creates in Visual Studio, the only completion I see is http.createStylesheet.

Here's my complete server.js code:
var http = require('http');
var sys = require('sys');
var server = http.createServer(function(request, response) {
    request.addListener('end', function() {
        response.writeHead(200, { 'Content-Type': 'text/plain' });

//Default code that was put in by NTVS
//var port = process.env.port || 1337;
//http.createServer(function (req, res) {
//    res.writeHead(200, { 'Content-Type': 'text/plain' });
//    res.end('Hello World\n');
Even though Intellisense doesn't show that createServer is there, if I uncomment out the default code, I see "Hello World" display in my browser, so it is working.

Dec 6, 2013 at 8:28 PM
Weird, the createStylesheet showing up is a little surprising. Do you have any other files in your project or have you installed any packages via npm?