Error while uploading a Nodejs application to Heroku

Asked

Viewed 273 times

3

While performing the eating:

git push heroku master

LOG:

-----> Node.js app detected

parse error: Unfinished string

!     Unable to parse package.json

-----> Build failed



We're sorry this build is failing! You can troubleshoot common issues here:

https://devcenter.heroku.com/articles/troubleshooting-node-deploys

If you're stuck, please submit a ticket so we can help:

https://help.heroku.com/

Love,

Heroku


!     Push rejected, failed to compile Node.js app.

!     Push failed

package.json file

{
  "name": "application-name",
  "version": "0.0.1",
  "description": "Contatos com NodeJS",
  "engines": {
    "node": "6.10.2",
    "npm": "3.10.10"
  },
  "scripts": {
    "start": "node app.js",
  },
  "dependencies": {
    "bcrypt-nodejs": "0.0.3",
    "body-parser": "~1.0.0",
    "cookie-parser": "~1.0.1",
    "debug": "~0.7.4",
    "express": "~4.0.0",
    "express-flash": "0.0.2",
    "express-load": "^1.1.15",
    "express-session": "latest",
    "express-validator": "^3.2.0",
    "jade": "~1.3.0",
    "moment": "^2.18.1",
    "mongoose": "^4.9.6",
    "morgan": "~1.0.0",
    "nodemailer": "^4.0.1",
    "static-favicon": "~1.0.0"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/mariojbe/contatos_NodeJS"
  },
  "keywords": [
    "node",
    "heroku",
    "express"
  ],
  "license": "MIT"
}

1 answer

2

The error returned is very clear

Unable to parse package.json

That is, the package.json file is invalid.

See in the attribute scripts, has the attribute start, its value and then a comma, remove the comma.

You can always use some tools to validate this. I used the Jsonlint.

"scripts": {
   "start": "node app.js"
},

Complete file

{
  "name": "application-name",
  "version": "0.0.1",
  "description": "Contatos com NodeJS",
  "engines": {
    "node": "6.10.2",
    "npm": "3.10.10"
  },
  "scripts": {
    "start": "node app.js"
  },
  "dependencies": {
    "bcrypt-nodejs": "0.0.3",
    "body-parser": "~1.0.0",
    "cookie-parser": "~1.0.1",
    "debug": "~0.7.4",
    "express": "~4.0.0",
    "express-flash": "0.0.2",
    "express-load": "^1.1.15",
    "express-session": "latest",
    "express-validator": "^3.2.0",
    "jade": "~1.3.0",
    "moment": "^2.18.1",
    "mongoose": "^4.9.6",
    "morgan": "~1.0.0",
    "nodemailer": "^4.0.1",
    "static-favicon": "~1.0.0"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/mariojbe/contatos_NodeJS"
  },
  "keywords": [
    "node",
    "heroku",
    "express"
  ],
  "license": "MIT"
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.