I'm really new to Heroku and I've been trying to deploy a Hello World app with node.js.
The problem is that I have this
error: failed to push some refs to 'https://git.heroku.com/sebasaenz.git'
but I don't really know how to solve the problem. By the previous error messages, it seems to be related to the package.json file, but I tried to find in the documentation what could be the problem and I really didn't understand what could it be.
Here's the error message after entering git push heroku master
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (6/6), 920 bytes | 0 bytes/s, done.
Total 6 (delta 0), 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 14, column 3
remote: ! Unable to parse package.json
remote:
remote:
remote: -----> Build failed
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 sebasaenz.
remote:
To https://git.heroku.com/sebasaenz.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/sebasaenz.git'
My package.json file is the following:
{
"name": "hello-world",
"version": "1.0",
"description": "Node demo",
"engines": {
"node": "5.9.1"
},
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"ejs": "2.4.1"
}, //this is line 14
"repository": {
"type": "git",
"url": "https://git.heroku.com/sebasaenz.git"
},
"keywords": [
"node",
"heroku"
],
"license": "MIT"
}
I've already looked for posts with similar characterstics, but I didn't find nothing that could help me.
您提供的JSON中唯一无效的位是依赖项中"ejs": "2.4.1"
和关键字数组中"heroku"
后的逗号。
I had the same problem. Note these two lines from heroku:
remote: parse error: Expected another key-value pair at line 14, column 3
remote: ! Unable to parse package.json
There is something wrong with your package.json file. In my case, I was missing a parenthesis to close out the file at the end. See the example below:
{
"name": "tempdeployment",
"version": "1.0.0",
"description": "This version of __ is for temporary deployment.",
"main": "app.js",
"scripts": {
"test": "test.js",
"start": "node app.js"
},
"author": "____",
"license": "ISC",
"dependencies": {
"ejs": "^2.5.7",
"express": "^4.16.2",
"request": "^2.83.0"
},
"engines": {
"node":"^8.9.4"
}
Notice that this JSON file is missing a closing parenthesis. Once I added the parenthesis, I had no problems deploying. In your case, it looks like you have a problem with one of your key-value pairs at line 14. Fix that, and your app should deploy without a problem.
Here is the corrected version of my package.json file:
{
"name": "tempdeployment",
"version": "1.0.0",
"description": "This version of __ is for temporary deployment.",
"main": "app.js",
"scripts": {
"test": "test.js",
"start": "node app.js"
},
"author": "____",
"license": "ISC",
"dependencies": {
"ejs": "^2.5.7",
"express": "^4.16.2",
"request": "^2.83.0"
},
"engines": {
"node":"^8.9.4"
}
}
mvn clean install
然后推送到heroku大师。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.