NodeJS应用程序使用Heroku构建,但它显示应用程序错误

时间:2016-12-28 03:36:35

标签: javascript node.js heroku deployment

我正在设置NodeJS Heroku应用程序。我只想要一个空的应用程序启动并运行。

我的目录包含package.json和app.js文件。

Heroku应用程序构建没有错误,但后来我在URL(https://nameless-wave-98692.herokuapp.com/)上得到了一个"应用程序错误" -page。

据我所知,日志中的一切看起来都不错:

-----> Node.js app detected
-----> Creating runtime environment

       NPM_CONFIG_LOGLEVEL=error
       NPM_CONFIG_PRODUCTION=true
       NODE_ENV=production
       NODE_MODULES_CACHE=true
-----> Installing binaries
       engines.node (package.json):  6.9.2
       engines.npm (package.json):   unspecified (use default)

       Downloading and installing node 6.9.2...
       Using default npm version: 3.10.9
-----> Restoring cache
       Loading 2 from cacheDirectories (default):
       - node_modules
       - bower_components (not cached - skipping)
-----> Building dependencies
       Installing node modules (package.json)
-----> Caching build
       Clearing previous node cache
       Saving 2 cacheDirectories (default):
       - node_modules
       - bower_components (nothing to cache)
-----> Build succeeded!
       └── (empty)
         !     This app may not specify any way to start a node process
       https://devcenter.heroku.com/articles/nodejs-support#default-web-process-type
-----> Discovering process types
       Procfile declares types     -> (none)
       Default types for buildpack -> web
-----> Compressing...
       Done: 13.4M
-----> Launching...
       Released v4
       https://nameless-wave-98692.herokuapp.com/ deployed to Heroku

你看到有什么问题吗?我做错了吗?

2 个答案:

答案 0 :(得分:1)

答案 1 :(得分:1)

也许您需要文件 Procfile

web: node app.js

enter image description here

enter image description here

相关问题