heroku错误:期望另一个键值对 [英] heroku error: Expected another key-value pair
问题描述
我试图根据heroku的指示首次将一个nodejs应用程序部署到heroku中 here
当我运行 git push heroku master
时,它开始编译应用程序,但是当它达到100%时,我得到这个
解析错误:期望在第18行第1列的另一个键值对
!推送被拒绝,未能编译Node.js应用
到git@heroku.com:agile-sands-7020.git
! [remote rejected] master - > master(pre-receive hook refused)
错误:无法将某些参考文献推送到'git@heroku.com:agile-sands-7020.git'
我用 ssh-keygen -t rsa
创建了新的密钥,并将它们与 heroku键:添加
但我仍然得到这个错误。有人可以帮助我吗?
嗯,我弄明白了,这个神秘的错误与package.json文件有关。基本上,我通过在一个单独的json对象中声明了engine字段。
{
name:
版本:0.0.0,
description:以最优雅的方式侮辱海誓山盟,
main:server.js ,
dependencies:{
socket.io:〜0.9.16,
xml2js:〜0.4.1,
express :〜3.4.8
},
devDependencies:{},
scripts:{
test:echo \错误:指定的&& 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
}
}
应该是这样的:
<$ p $
name:elegant-insults,
version:0.0.0,
description:侮辱b $ bmain:server.js,
dependencies:{
socket.io:〜0.9.16,
xml2js:〜0.4.1,
express:〜3.4.8
},
devDependencies:{},
脚本:{
test:echo \错误:未指定测试&&退出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
}
}
I am trying to deploy a nodejs app to heroku for the first time, following heroku's instructions here
When I run git push heroku master
, it starts compiling the app, but when it reaches 100% and I get this
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'
I have created new keys with ssh-keygen -t rsa
and added them to heroku with heroku keys:add
but I still get this error. Can someone help me please?
Ah, I figured it out, this mysterious error has to do with the package.json file. Basically I botched the "engines" field by declaring it in a seperate json object
{
"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"
}
}
instead it should be like this:
{
"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"
}
}
这篇关于heroku错误:期望另一个键值对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!