我想一个应用程序的NodeJS部署到Heroku的首次,以下Heroku的说明在这里
当我运行时git push heroku master,它开始编译应用程序,但当它达到100%时,我得到了这个
parse error: Expected another key-value pair at line 18, column 1
! Push rejected, failed to compile Node.js app
To git@heroku.com:agile-sands-7020.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:agile-sands-7020.git'
Run Code Online (Sandbox Code Playgroud)
我已经创建了新的密钥ssh-keygen -t rsa
并将它们添加到heroku heroku keys:add但我仍然收到此错误.有谁可以帮助我吗?
我正在按照本教程制作HTML5游戏.我想尝试混合节点以使其成为多人游戏.我在服务器上使用node.js(v0.10.4),在前端使用crafty.js.
我正在使用socket.io来发送和接收消息.现在只是我(不是多个客户).发生的奇怪事情是来自服务器的消息似乎被多次发送.我在socket.io中启用了调试模式,但它似乎只发送了一次数据,但在前端数据似乎是以倍数形式进入.我在数据上设置了一个增量器,似乎增量器没有多次递增,而是我得到了相同数据的多个副本.
这是节点代码:
var http = require('http').createServer(handler),
static = require('node-static'),
io = require('socket.io').listen(http);
io.set('log level', 3);
http.listen(80);
//attach the socket to our server
var file = new static.Server(); //Create a file object so we can server the files in the correct folder
function handler(req, res) {
req.addListener('end', function() {
file.serve(req, res);
}).resume();
}
io.sockets.on('connection', function (socket) { //listen for any sockets that will come from the client
socket.on('collected', function(data) {
/**** here's where the data is being sent …Run Code Online (Sandbox Code Playgroud)