我在Visual Studio中创建了一个小型站点,并使用了Node.js和Express。我可以通过Visual Studio和Heroku本地网络访问它。但是,当尝试将其推送到Heroku时,出现错误:'heroku / nodejs'buildpack不支持该应用程序

我通读了Heroku提供的文档,但是没有找到任何解决方案。

ERROR: Application not supported by 'heroku/nodejs' buildpack
remote:  !
remote:  !     The 'heroku/nodejs' buildpack is set on this application, but was
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:  !     Portfolio/
remote:  !     Portfolio.sln
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

最佳答案

错误输出非常简单-确保您的package.json位于项目的顶级目录中,然后尝试再次部署。根据您的评论,package.json似乎位于{project_root}/Portfolio/package.json而不是{project_root}/package.json

09-11 00:27
查看更多