简体   繁体   English

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

[英]NodeJS app builds with Heroku, but it shows application error

I am setting up a NodeJS Heroku app. 我正在设置一个NodeJS Heroku应用程序。 I just want an empty app up and running. 我只希望一个空的应用程序启动并运行。

My dir includes a package.json and an app.js file. 我的目录包括package.json和一个app.js文件。

The Heroku app builds without errors, but then I just get an "application error"-page on the URL ( https://nameless-wave-98692.herokuapp.com/ ). Heroku应用程序的构建没有错误,但是随后我在URL( https://nameless-wave-98692.herokuapp.com/ )上看到一个“应用程序错误”页面。

As far as I can see, everything looks good in the logs: 据我所知,一切在日志中看起来都不错:

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

Do you see any problems? 你有什么问题吗? Am I doing something wrong? 难道我做错了什么?

Maybe you need file Procfile 也许您需要文件Procfile

web: node app.js

在此处输入图片说明

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM