【问题标题】:Heroku is not dectecting Node.js buildpacksHeroku 没有检测到 Node.js 构建包
【发布时间】:2020-09-21 12:11:32
【问题描述】:

我正在使用 Heroku 并尝试部署我的代码,但是当我尝试部署时出现错误。

它说它没有检测到任何构建包,但我已经进行了版本检查并安装了最新的 Node.js。

我有什么遗漏吗?

终端:

Creating app... done, ⬢ boiling-lake-07398
https://boiling-lake-07398.herokuapp.com/ | https://git.heroku.com/boiling-lake-07398.git
Shons-MacBook-Pro:Newsletter-Signup shonswope$ git push heroku master
Enumerating objects: 1305, done.
Counting objects: 100% (1305/1305), done.
Delta compression using up to 4 threads
Compressing objects: 100% (1248/1248), done.
Writing objects: 100% (1305/1305), 1.87 MiB | 455.00 KiB/s, done.
Total 1305 (delta 179), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote:  !     No default language could be detected for this app.
remote:                         HINT: This occurs when Heroku cannot detect the buildpack to use for this a
pplication automatically.
remote:                         See https://devcenter.heroku.com/articles/buildpacks
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to pacific-bastion-08294.
remote: 
To https://git.heroku.com/pacific-bastion-08294.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/pacific-bastion-08294.git'
Shons-MacBook-Pro:Newsletter-Signup shonswope$ npm --version
6.12.0
Shons-MacBook-Pro:Newsletter-Signup shonswope$ node --version
v12.13.0
Shons-MacBook-Pro:Newsletter-Signup shonswope$ git --version
git version 2.24.3 (Apple Git-128)
Shons-MacBook-Pro:Newsletter-Signup shonswope$ 

【问题讨论】:

    标签: node.js git heroku terminal hyper


    【解决方案1】:

    不过,按照错误消息中的documentation mentioned,尝试明确设置构建包:

    heroku buildpacks:set heroku/nodejs
    

    如果您删除或重命名以前导致自动检测您的应用程序类型并因此自动设置在您的应用程序上检测到的构建包的文件,也可能会发生这种情况。

    还要检查 the answer for this question 和您的 package.json content。
    作为seen here,package.json 和Procfile 必须在项目的根文件夹中。

    【讨论】:

      猜你喜欢
      • 2019-02-01
      • 2021-02-22
      • 2021-07-17
      • 2016-12-04
      • 1970-01-01
      • 2015-01-24
      • 2013-05-04
      • 2021-05-02
      • 1970-01-01
      相关资源
      最近更新 更多