heroku错误:期望另一个键值对

时间:2014-02-17 02:39:49

标签: node.js heroku

我正在尝试按照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但我仍然收到此错误。有人能帮帮我吗?

1 个答案:

答案 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"
  }
}
相关问题