I installed Node.js tools for Visual Studio and created a new TypeScript > Node.js > Blank Node.js console application project.
Currently I only have one file (sender.ts). Code below:
var redis = require('redis');
var client = redis.createClient(); //creates a new client
client.on('connect', function () {
console.log('connected');
});
client.on('ready', function () {
client.publish('agent', 'I am sending a message.');
});
When I build the project, I get a compilation error Cannot find name 'require'. on line 1.
Can anyone help in explaining why this happens and how I can fix it?