【问题标题】:receive an error when pushing node.js app on heroku在 heroku 上推送 node.js 应用程序时收到错误
【发布时间】:2017-11-23 15:52:40
【问题描述】:

当我尝试将我的 node.js 应用程序上传到 heroku 时,我收到此错误

 -----> Node.js app detected
remote: parse error: Unfinished JSON term
remote:  !     Unable to parse package.json
remote: 
remote: 
remote: -----> Build failed
remote: parse error: Unfinished JSON term
remote: parse error: Unfinished JSON term
remote:        

谁能告诉我如何克服这个问题?这是 package.JSON 文件

{
"name": "myapp",
"version": "1.0.0",


"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js",
"engines": {
"node": ">=50.9" 
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.16.2",
"twilio": "^3.9.3"
}



}

谢谢你

【问题讨论】:

  • 您需要在此处发布您的 package.json。那里可能有语法错误。
  • 对不起。我现在已经添加了
  • 您的“节点”版本看起来很可疑:">=50.9" ??也许你的意思是 5.9?
  • 我把它改成 8.5.0 还是不行。抱歉,我已经尝试让它工作 4 个小时了

标签: node.js heroku hosting


【解决方案1】:

在“开始”之后关闭“脚本”条目:

{
 "name": "myapp",
 "version": "1.0.0",
 "description": "",
 "main": "index.js",
 "scripts": {
    "start": "node index.js"
 },
 "engines": {
   "node": ">=5.9" 
 },
 "author": "",
 "license": "ISC",
 "dependencies": {
    "express": "^4.16.2",
    "twilio": "^3.9.3"
 }

}

【讨论】:

  • 谢谢!现在,当我运行 push heroku master 时,我收到了这个长错误“npm ERR!/tmp/build_a0faeb77bf9f3de27aa308181810d990/node_modules/sshpk/binsshpk-conv”它还说可能的问题是节点模块已检查到源代码控制中。
  • 把 node_modules 放到你的 .gitignore 中。
猜你喜欢
  • 2019-03-02
  • 2017-01-31
  • 2020-09-12
  • 1970-01-01
  • 2012-03-10
  • 1970-01-01
  • 1970-01-01
  • 2019-05-12
  • 2015-01-01
相关资源
最近更新 更多