为什么Heroku无法检测到Node.js buildpack? [英] Why does Heroku fail to detect Node.js buildpack?

查看:294
本文介绍了为什么Heroku无法检测到Node.js buildpack?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

git克隆了一个Node.js应用程序(在package.json中指定的版本是4.1.2,而本地机器的版本是6.2.2),并试图在Heroku上推送。但它未能生成并给出此错误:

 未能检测到set buildpack https< span>:< / span> / /codon-buildpacks.s3.amazonaws&period;com/buildpacks/heroku/nodejs.tgz 

现在我将buildpack设置为heroku / nodejs,并且收到以下消息:

  Buildpack集。在lit-badlands-92088上的下一个版本将使用heroku / nodejs。 
运行git push heroku master使用这个buildpack创建一个新版本。

现在当我运行 git push heroku master ,我再次被告知:

  remote:----->未能检测到set buildpack https< span>:
< / span> // codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/nodejs.tgz

remote:更多信息:
https://devcenter.heroku.com/articles/buildpacks#detection-failure

远程:
远程:!推送失败
remote:验证部署...
remote:
remote:!被拒绝接受光照荒地92088。

即使设置了Node.js buildpack,也可能检测不到可能的原因?

解决方案

这意味着 package.json 到你的git项目的根目录,所以Heroku发现它不是Node.js应用程序。你可以在本地看到:

  git show master:package.json 

为了解决这个问题,你需要确定项目根目录中有一个package.json(其中还有一个.git目录),并添加到git中:

  git add package.json 
git commit -m'track package.json'

可以改进措辞('未检测到set buildpack')。它可能应该说'未能检测到Node.js应用程序'。当buildpack的检测脚本运行时( https://github.com/heroku/ heroku-buildpack-nodejs / blob / master / bin / detect ),它会查找一个package.json文件来验证是否有可用的节点应用程序可以构建。


I git cloned a Node.js application (the version specified in the package.json being 4.1.2 and that of my local machine being 6.2.2) and tried to git push on Heroku. But it failed to build and gave this error:

Failed to detect set buildpack https<span>:</span>//codon-buildpacks.s3.amazonaws&period;com/buildpacks/heroku/nodejs.tgz

Now I set the buildpack to heroku/nodejs and I get this message:

Buildpack set. Next release on lit-badlands-92088 will use heroku/nodejs.
Run git push heroku master to create a new release using this buildpack.

Now when I run git push heroku master, I am again told:

remote: -----> Failed to detect set buildpack https<span>:
</span>//codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/nodejs.tgz  

remote: More info: 
https://devcenter.heroku.com/articles/buildpacks#detection-failure  

remote:  
remote:  !     Push failed  
remote: Verifying deploy...  
remote:  
remote: !       Push rejected to lit-badlands-92088.

What could be the possible reasons for the Node.js buildpack not being detected even if I set it?

解决方案

This means that a package.json file isn't checked into the root of your git project, so Heroku is detecting that it isn't a Node.js app. You can see this locally:

git show master:package.json

To fix it, you'll want to be sure there is a package.json in the root of your project (where there is also a .git directory), and add it to git:

git add package.json
git commit -m 'track package.json'

The phrasing ('failed to detect set buildpack') could be improved. It should probably say 'failed to detect Node.js app'. When the buildpack's "detect" script is run (https://github.com/heroku/heroku-buildpack-nodejs/blob/master/bin/detect), it looks for a package.json file to verify that there's a node app available to build.

这篇关于为什么Heroku无法检测到Node.js buildpack?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆