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