繁体   English   中英

使用Heroku进行节点部署时出现“应用程序错误”

[英]“Application Error” when deploying with Heroku for node

我终于设法在本地制作了一个易于运行的客户端-服务器简易应用程序(经过数周的尝试),并且...我尝试尝试一下Heroku,所以我的最后一台服务器是如此令人困惑和沮丧。 看来它正在运行,但是...“正常”部署后,网络显示“应用程序中发生错误,无法提供您的页面。如果您是应用程序所有者,请检查日志以了解详细信息。”。

我发现诸如允许在process.env.PORT上运行,并且不仅修复了8080端口,还修复了相同的错误,尽管仍然可以在本地运行。 有什么建议吗?

部署日志...

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

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

       Resolving node version 8.x...
       Downloading and installing node 8.11.1...
       Using default npm version: 5.6.0
-----> Restoring cache
       Loading 2 from cacheDirectories (default):
       - node_modules
       - bower_components (not cached - skipping)
-----> Building dependencies
       Installing node modules (package.json + package-lock)
       up to date in 3.888s
-----> Caching build
       Clearing previous node cache
       Saving 2 cacheDirectories (default):
       - node_modules
       - bower_components (nothing to cache)
-----> Pruning devDependencies
       Skipping because npm 5.6.0 sometimes fails when running 'npm prune' due to a known issue
       https://github.com/npm/npm/issues/19356

       You can silence this warning by updating to at least npm 5.7.1 in your package.json
       https://devcenter.heroku.com/articles/nodejs-support#specifying-an-npm-version
-----> Build succeeded!
-----> Discovering process types
       Procfile declares types     -> (none)
       Default types for buildpack -> web
-----> Compressing...
       Done: 19.4M
-----> Launching...
       Released v5
       https://myweb.herokuapp.com/ deployed to Heroku

在JSON文件中,您是否建议您包含“开始”值,这是您希望服务器在启动时执行的命令。 对于节点,JSON的开始应如下所示:

{
  "name": "deploying",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node app.js"

希望这可以帮助 :)

暂无
暂无

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

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