【问题标题】:Heroku app won't deploy parse error: Expected another key-value pair at line 10, column 3 node.jsHeroku 应用程序不会部署解析错误:预计在第 10 行第 3 列 node.js 有另一个键值对
【发布时间】:2014-06-21 15:19:54
【问题描述】:

我不明白为什么我的应用无法部署!它与 package.json 文件有关吗?我错过了什么吗?任何帮助将不胜感激!我的终端出现以下错误:

Initializing repository, done.
Counting objects: 8405, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6078/6078), done.
Writing objects: 100% (8405/8405), 90.85 MiB | 726.00 KiB/s, done.
Total 8405 (delta 1988), reused 8183 (delta 1869)

-----> Removing .DS_Store files
-----> Node.js app detected
parse error: Expected another key-value pair at line 10, column 3

 !     Push rejected, failed to compile Node.js app

To git@heroku.com:stormy-brushlands-6191.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:stormy-brushlands-6191.git'

{
  "name": "MotionTherapy",
  "version": "0.0.1",
  "private": "true",
  "dependencies": {
    "express": "3.0.0alpha4",
    "jade": "*",
    "stylus": "*",
    "nib": "*",
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node server.js"
  },
  "author": "Sophie-Plimbley",
  "license": "ISC",
  "engines": {
    "node": "0.10.x"
  },
  "repository": {
    "type": "git",
    "url": "git@heroku.com:stormy-brushlands-6191.git"
  }
}

【问题讨论】:

    标签: node.js git heroku


    【解决方案1】:

    这是由于第 10 行末尾的尾随逗号。不允许使用它们,as per this answer。 JSON 解析器需要另一个 'packagename': 'version' 对,但没有。解决方法很简单:改变这个:

    "nib": "*",
    

    收件人:

    "nib": "*"
    

    【讨论】:

    • 谢谢,看来是这样,该应用程序现已部署到 Heroku,但在网站上显示“应用程序发生错误,无法提供您的页面。”你知道吗?这可能是?解决一件事,另一件事弹出!
    • 该应用程序在我的本地机器上运行,地址为 localhost:3000,我需要重定向它吗? @RikkusRukkus
    • 我不是 Heroku 用户,但据我了解,Heroku 只允许您使用单个端口,这不是您自己选择的。允许的端口在环境变量PORT (process.env.PORT) 中指定。尝试使用example listed in the FAQ
    • 这也不起作用,我的heroku日志中有很多错误,例如npm ERR!代码生命周期?你知道那是什么吗?我不确定自己,我将继续四处寻找。感谢您到目前为止的帮助! @RikkusRukkus
    【解决方案2】:

    仅供参考,如果您尚未提交所有更改(特别是对您的 package.json 文件),您的 git push heroku master 命令可能会收到此错误。那是我的问题。

    【讨论】:

      猜你喜欢
      • 2021-11-30
      • 2019-03-26
      • 2014-03-16
      • 1970-01-01
      • 2017-05-07
      • 2021-02-12
      • 2021-05-10
      • 1970-01-01
      • 2017-02-04
      相关资源
      最近更新 更多