我正在尝试按照heroku的说明here
首次将nodejs应用程序部署到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'
我使用ssh-keygen -t rsa
创建了新密钥
并使用heroku keys:add
将它们添加到heroku但我仍然收到此错误。有人能帮帮我吗?
答案 0 :(得分:8)
啊,我想通了,这个神秘的错误与package.json文件有关。基本上我通过在一个单独的json对象中声明它来破坏“引擎”字段
{
"name": "elegant-insults",
"version": "0.0.0",
"description": "Insult eachother in the most elegant of ways",
"main": "server.js",
"dependencies": {
"socket.io": "~0.9.16",
"xml2js": "~0.4.1",
"express": "~3.4.8"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"author": "roman-sharf",
"license": "ISC",
"repository": {
"type": "git",
"url": "git@heroku.com:elegant-insults.git"
}
},
{
"engines": {
"node": "0.10.x"
}
}
相反它应该是这样的:
{
"name": "elegant-insults",
"version": "0.0.0",
"description": "Insult eachother in the most elegant of ways",
"main": "server.js",
"dependencies": {
"socket.io": "~0.9.16",
"xml2js": "~0.4.1",
"express": "~3.4.8"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"author": "roman-sharf",
"license": "ISC",
"engines": {
"node": "0.10.x"
},
"repository": {
"type": "git",
"url": "git@heroku.com:elegant-insults.git"
}
}