Why does Heroku fail to detect Node.js buildpack?

前端 未结 7 887
慢半拍i
慢半拍i 2020-12-14 16:18

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) an

7条回答
  •  既然无缘
    2020-12-14 16:58

    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.

提交回复
热议问题