错误:无法将某些引用推送到“ https://git.heroku.com/readingcom.git”

时间:2020-06-20 13:30:52

标签: node.js reactjs heroku

! [remote rejected] master -> master (pre-receive hook declined)

我一直在尝试从git repo ohheroku部署此应用程序,但是预接收钩拒绝错误不断弹出

在此处输入代码

remote: sh: 1: react-scripts: Permission denied
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 126
remote: npm ERR! client@0.1.0 build: `react-scripts build`
remote: npm ERR! Exit status 126
remote: npm ERR!
remote: npm ERR! Failed at the client@0.1.0 build script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote: 
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR!     /tmp/npmcache.SgBaJ/_logs/2020-06-19T18_16_40_663Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 126
remote: npm ERR! readingcom@1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client`
remote: npm ERR! Exit status 126
remote: npm ERR!
remote: npm ERR! Failed at the readingcom@1.0.0 heroku-postbuild script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR!     /tmp/npmcache.SgBaJ/_logs/2020-06-19T18_16_40_679Z-debug.log
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:        Some possible problems:
remote:
remote:        - node_modules checked into source control
remote:          https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits
remote:
remote:        - Node version not specified in package.json
remote:          https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
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 readingcom.
remote:
To https://git.heroku.com/readingcom.git
 ! [remote rejected]   master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/readingcom.git'

该应用是MERN堆栈应用。我已经检查并更新了我的依赖项,heroku CLI等。

4 个答案:

答案 0 :(得分:0)

我也遇到类似的问题。我刚刚用“ npm run build”创建了一个生产版本。...然后用构建文件夹推送了节点应用程序。

在节点应用中配置此

maskA = df1.eq(df2)

JA  AB  BC  fas waa ad
1   True    True    True    True    True    True
2   True    False   True    True    False   True
3   True    True    False   True    True    True
4   True    True    True    False   True    False
5   True    False   False   False   False   True
6   True    True    True    True    True    True
7   True    False   True    False   False   True
8   True    True    False   True    True    True
9   True    False   False   True    False   True
10  True    True    True    True    True    False

df_1 = df1[~maskA].fillna('')
maskB = df2.eq(df1)
df_2 = df2[~maskB].fillna('')
df_1['JA'].update(df1['JA'])
df_2['JA'].update(df2['JA'])

df_all = pd.merge(df_1, df_2, on='JA', suffixes=('_df1','_df2')).sort_index(axis=1)
cols = ['JA','AB_df1','AB_df2','BC_df1','BC_df2','ad_df1','ad_df2','fas_df1','fas_df2','waa_df1','waa_df2']
df_all.loc[:,cols]

df_all
    JA  AB_df1  AB_df2  BC_df1  BC_df2  ad_df1  ad_df2  fas_df1 fas_df2 waa_df1 waa_df2
0   1                                       
1   22  a e ace                         78  18
2   36          4   1                       
3   45                  as  ms  2   12      
4   51              5           25  5       
5   61                                      
6   897 a   paa                 13  23  34  
7   88              11                      
8   29  jaa aa  1                       45  5
9   18                  aa  a               

在heroku上按一下就可以了...这有点古怪,不能真正解决问题,但是如果您急于尝试,可以尝试一下

答案 1 :(得分:0)

我今天也遇到了这个问题...

在我的研究中,我必须有很多答案,这些答案只能解决一个问题,但不能解决所有问题...

最后,重新读取我收到的错误,我发现collectstatic是第一个通知的错误,

运行'$ python manage.py collectstatic --noinput'时出错。

由于这是一个手动查询,因此我使用以下代码手动完成了

./manage.py collectstatic

(要使此命令行正常工作,必须在setting.py中指定STATIC_ROOT)

setting.py

STATIC_ROOT = os.path.join (BASE_DIR, 'my_static_app_folderName/static')

此后,您必须在部署期间使用命令行禁用此请求的自动执行

heroku config:set DISABLE_COLLECTSTATIC = 1

(对于heroku用户)

然后重新启动

git push heroku master

它应该可以工作...

答案 2 :(得分:0)

另一种方式....

您可以通过以下方式检查您的git状态

$ git status

如果您有一个必须由git in检查的文件夹

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .gitignore
        Procfile

或在

Changes not staged for commit:
    modified:   store/settings.py

你必须做

$ git add store/
$ git add Procfile

这些部分中的每个文件和文件夹,.gitignore文件除外。 之后,您再次使用

进行检查
$ git status

如果一切正常,现在就可以

$ git commit -m "Launching to production"

应用git添加...

通过以下方式验证您的应用配置

$ heroku config

再试一次

$ git push heroku master

希望,它将起作用!!!

请问我的英语水平

答案 3 :(得分:0)

在尝试将创建反应应用程序部署到heroku时遇到了相同的问题。 这是由于我不小心将node_modules文件夹提交到了我的git存储库。

问题已解决

  • 运行git rm -r --cached node_modules
  • node_modules/添加到.gitignore文件
  • 再次提交更改并运行git push heroku master