2014-02-23 65 views
4

当我做一个git push heroku master时,我得到一个解析错误。 Heroku告诉我哪个行和列导致解析错误,但不是哪个文件。如何找出哪个文件heroku解析有问题?请指教。git push heroku master解析错误失败 - 哪个文件?

----- package.json ----- 

{ 
    "name": "mean", 
    "version": "0.0.1", 
    "private": true, 
    "scripts": { 
    "start": "node server.js" 
    }, 
    "dependencies": { 
    "mongoose": "3.8.7", 
    "express": "3.4.8", 
    "jade": "*", 
    "stylus": "*" 
    }, 
    "engines": { 
    "node": "0.10.x", 
    "npm": "1.4.x" 
    } 
} 

----- output ----- 

[23:46 56] git push heroku master 
Initializing repository, done. 
Counting objects: 259, done. 
Delta compression using up to 8 threads. 
Compressing objects: 100% (242/242), done. 
Writing objects: 100% (259/259), 927.54 KiB | 550.00 KiB/s, done. 
Total 259 (delta 13), reused 0 (delta 0) 

-----> Node.js app detected 
parse error: Expected separator between values at line 13, column 16 

!  Push rejected, failed to compile Node.js app 

To [email protected]:mighty-mountain-5447.git 
! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to '[email protected]:mighty-mountain-5447.git' 
+0

在提交之前运行[jshint](http://www.jshint.com/)(最好用grunt)。它应该告诉你是否有什么需要用你的js修复。 –

+0

我正在使用jshint。看起来很好。这就是为什么这是如此令人费解。我希望他们只会说出哪个文件有问题。 – RBR

回答

7

发生在我身上过,这是我在.json文件无缘逗号。

你可能不把那个逗号第13行右走,你COMMITED

}, 

再次提交,然后推到Heroku的。

+0

我的package.json如上所示。我看到它里面没有丢失的逗号。你做? – RBR

+1

有几个答案。再次提交帮助! :) – ProgramCpp

+0

是的,我发现我错过了逗号,但后来忘了提交它。 – eflat

6

我刚刚得到了同样的确切错误。在我的情况下,问题是在package.json文件,因为我错过了逗号后我手动添加的“引擎”来了:

{ 
    "engines": { 
     "node": "0.10.x" 
    }, <-- missed this comma here 

    "name": "heroku",... 
+0

我的package.json如上所示。我看到它里面没有丢失的逗号。你做? – RBR

+0

当然不是......你可以发布你的js文件吗? – Nikola

+0

Ahaha,当场喝彩,谢谢) –

1

真实发生的事情是,你已经提交你的代码错误缺少冒号与git /逗号。在运行git push heroku master之前,您需要git commit -a以便将修复代码推送到heroku。