node.js - Heroku 未检测到 Node.js 应用程序
问题描述
我在 Visual Studio 中创建了一个小站点,并使用了 Node.js 和 Express。我可以通过 Visual Studio 和 Heroku 本地网络访问它。但是,当尝试将其推送到 Heroku 时,出现错误:Application not supported by '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
解决方案
看看这个错误信息。
Heroku 上的 Node.js 应用程序在目录结构的根目录中需要一个“package.json”。
您的 package.json 是否在根目录中?
推荐阅读
- perl - Windows 10 上的草莓 perl 在当前目录中找不到模块
- scilab - 在 scilab 中使用 fsolve 时如何克服“scilab 参数函数返回的变量不正确”?
- python - 部署到 Google App Engine Flexible 时 Python 相对路径出现问题
- c++ - 在大数组大小的情况下出现段错误的原因
- javascript - 通过 POST (Ajax) 的数组
- c# - 无法执行程序和程序包
- javascript - 在 vuejs 中使用 v-for 循环?
- mysql - 需要帮助理解 COUNT 和 <> 运算符(Hackerrank SQL 挑战问题)
- mysql - 什么是停止事务的查询?
- python - 如何修复“Python 中的 While 循环”在我的代码中不起作用