带有soundcloud模块的节点

如何在节点中访问soundcloud api,当我尝试为节点中的soundcloud api模块声明variables时,出现错误。

这是我的代码:

var express = require('express'), app = express(), path = require('path'), SC = require('soundcloud'); //causing my server won't run app.get('/', function(req,res){ res.sendFile(path.join(__dirname + '/indexAPI.html')); }); app.listen(8080); 

我得到这样的错误消息: TypeError: Cannot read property 'getUserMedia' of undefined

当试图使用soundcloud api时,getUserMedia是什么意思,为什么当我刚刚开始为soundcloud api声明variables时,会出现这种情况: SC = require('soundcloud');

您正在尝试使用您在前端使用的Soundcloud库。

相反,您需要使用Node Soundcloud库。

npm install --save node-soundcloud

然后var SC = require('node-soundcloud');

有关该软件包的更多信息,请访问: https : //www.npmjs.com/package/node-soundcloud