0
我安装了Node.js tools for Visual Studio并创建了一个新的TypeScript> Node.js>空Node.js控制台应用程序项目。VS2015 Typescript找不到名称'require'
目前我只有一个文件(sender.ts)。下面的代码:
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.');
});
当我生成项目,我得到一个编译错误找不到名称“要求”。上线1.
任何人都可以帮助解释为什么发生这种情况,我怎么能解决它?
http://stackoverflow.com/questions/31173738/typescript-getting-error-ts2304-cannot-find-name -require#answer-31263434 –
起初这个答案并没有解决我的问题,但我必须改变一些事情。它现在有效。 –