简体   繁体   English

由于出现神秘错误,我无法将node.js部署到Heroku

[英]I cannot deploy node.js to Heroku due to a mysterious error

C:\Users\Archie Jugdersuren\summaproject_trial3 - Copy 6 - heroku2>git push 
heroku master
Counting objects: 3247, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3049/3049), done.
Writing objects: 100% (3247/3247), 3.88 MiB | 496.00 KiB/s, done.
Total 3247 (delta 811), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote: parse error: Expected another key-value pair at line 20, column 3
remote:  !     Unable to parse package.json
remote:
remote:
remote: -----> Build failed
remote: parse error: Expected another key-value pair at line 20, column 3
remote: parse error: Expected another key-value pair at line 20, column 3
remote:
remote:        We're sorry this build is failing! You can troubleshoot 
common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-
deploys
remote:
remote:        If you're stuck, please submit a ticket so we can help:
remote:        https://help.heroku.com/
remote:
remote:        Love,
remote:        Heroku
remote:
remote:  !     Push rejected, failed to compile Node.js app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to summ2.
remote:
To https://git.heroku.com/summ2.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/summ2.git'

I have tried everything. 我已经尝试了一切。 Here is the strange part on line 20 column 3 there is nothing wrong with it!!! 这是第20行第3列中的奇怪部分,没有错!!! I even got rid of the original line to see if the error still persist and it did. 我什至摆脱了原始行,看错误是否仍然存在并且确实存在。 In addition, I got rid of the whole entire package.json file and it still pointed to line 20 column 3 even when package.json was empty. 另外,我摆脱了整个package.json文件,即使package.json为空,它仍然指向第20行第3列。 I have uninstall and reinstalled Heroku and no luck... I have doubled checked my dependencies 我已经卸载并重新安装了Heroku,也没有运气...我已经仔细检查了我的依赖项

Here is package.json: 这是package.json:

{
  "name": "hello world",
  "version": "0.0.0",
  "engines": {
    "node": "6.11.0"
  },
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "body-parser": "1.17.2",
    "cheerio": "1.0.0-rc.2",
    "cookie-parser": "1.4.3",
    "debug": "2.6.3",
    "ejs": "2.5.6",
    "express": "4.15.2",
    "google": "2.1.0",
    "jquery": "3.2.1",
    "morgan": "1.8.1",
    "request": "2.81.0",
    "serve-favicon": "~2.4.2"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/Mongols/Deploy-Node-To-Heroku.git"
  },
  "keywords": [
    "node",
    "heroku",
    "express"
  ],
  "license": "MIT"
}

Did you recommit your changes before pushing to heroku? 在推送到heroku之前,您是否重新提交了更改? Most answers regarding this question are a result of a missing or extra comma somewhere, I suggest putting your code through a json parser and checking to make sure you have all valid json. 关于此问题的大多数答案是某处缺少或逗号引起的,我建议将代码通过json解析器进行检查,以确保您具有所有有效的json。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM