【问题标题】:heroku error: Expected another key-value pairheroku 错误:预期另一个键值对
【发布时间】:2014-03-16 04:50:39
【问题描述】:

我第一次尝试将 nodejs 应用程序部署到 heroku,按照 heroku 的指示 here

当我运行 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,但我仍然收到此错误。有人可以帮帮我吗?

【问题讨论】:

    标签: node.js heroku


    【解决方案1】:

    啊,我想通了,这个神秘的错误与 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"
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2019-03-26
      • 2021-11-30
      • 2021-01-31
      • 2014-06-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-30
      • 1970-01-01
      相关资源
      最近更新 更多