推送到git的麻烦

问题描述 投票:1回答:1

我是git的新用户,并且无法推送。

我有一个我正在练习的Heroku应用程序。我已经安装了Heroku CLI,这就是我要做的:

heroku login //成功 heroku git:clone -a myapp //成功了,但警告说我克隆了一个空的存储库。据我了解,这是正常的吗? 然后,我在文件夹中创建一个readme.txt文件。这应该在/myappfolder中,还是在/myapp/.gitfolder中?

当我在git add readme.txt文件夹中执行myapp时终端不会给出任何错误og成功消息

然后我做git commit -am "add readme" //似乎成功

然后我做git push heroku master //失败

我推动时遇到的错误:

Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 471 bytes | 471.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/nodejs.tgz
remote:        
remote:  !     ERROR: Application not supported by 'heroku/nodejs' buildpack
remote:  !     
remote:  !     The 'heroku/nodejs' buildpack is set on this application, but wa
remote:  !     unable to detect a Node.js codebase.
remote:  !         
remote:  !     A Node.js app on Heroku requires a 'package.json' at the root of
remote:  !     the directory structure.
remote:  !     
remote:  !     If you are trying to deploy a Node.js application, ensure that this
remote:  !     file is present at the top level directory. This directory has the
remote:  !     following files:
remote:  !     
remote:  !     readme.txt
remote:  !         
remote:  !     If you are trying to deploy an application written in another
remote:  !     language, you need to change the list of buildpacks set on your
remote:  !     Heroku app using the 'heroku buildpacks' command.
remote:  !         
remote:  !     For more information, refer to the following documentation:
remote:  !     https://devcenter.heroku.com/articles/buildpacks
remote:  !     https://devcenter.heroku.com/articles/nodejs-support#activation
remote: 
remote: 
remote:        More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to myapp.
remote: 
To https://git.heroku.com/myapp.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/myapp.git'    

哪里出错了?

编辑

package.json

{
  "name": "myapp",
  "version": "1.0.0",
  "description": "lamwork",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "example",
    "heroku"
  ],
  "author": "My Name",
  "license": "ISC"
}, 
 "engines": {
    "node": "10.15.0"
  }
}   

提交package.json后,我在尝试推送时遇到此错误:

Counting objects: 8, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (8/8), 1.03 KiB | 528.00 KiB/s, done.
Total 8 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Node.js app detected
remote: parse error: Expected value before ',' at line 15, column 2
remote:  !     Unable to parse package.json
remote: 
remote: 
remote: -----> Change to Node.js build process 
remote:        Heroku has begun executing the "build" script defined in package.json
remote:        during Node.js builds.
remote: 
remote:        Read more: https://devcenter.heroku.com/changelog-items/1573
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 myapp.
remote: 
To https://git.heroku.com/myapp.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/myapp.git'
git heroku
1个回答
2
投票

然后,我在文件夹中创建一个readme.txt文件。它应该在/myapp文件夹中,还是在/myapp/.git文件夹中?

前者,/myapp。 Git使用/myapp/.git保存其内容。

remote:parse error:第15行第2列','之前的预期值

而你的package.json在该行包含错误。您错误地添加了}来终止JSON对象。解决它并再次冲压。

© www.soinside.com 2019 - 2024. All rights reserved.