0
我想有getCurrentSongData函数返回从刮刀传入的songdata对象,但我不断收到这样的输出:无法从另一个js文件中的NodeJS出口对象
******************TESTING****************
c:\Users\(PATH TO PROJECT FOLDER)\node_modules\mysql\lib\protocol\Parser.js:82
throw err;
^
TypeError: Cannot read property 'artist' of undefined
at getCurrentSongData
...
这里的我的routes.js文件的一部分,需要我的刮板。
function getCurrentSongData(un) {
var scraper = require('./scrape');
console.log("******************TESTING****************");
console.log("testfunct: " + scraper(un).artist);
return scraper(un);
}
我不知道如何将其应用于我的代码。函数dataLoaded是否在我的routes.js文件中或在scraper中? –
@NickR。 http://pastebin.com/cKNL9dij –
所以如果我试图从scraper的结果加载到routes.js文件我会把这个在routes.js?它似乎没有工作。 我也有一条路线: res.render('nowplaying.ejs',{songdata:getCurrentSongData(lastfm)}); –