我设法最终在本地制作了一个运行的客户端 - 服务器简易应用程序(经过数周的尝试)并且...我试图尝试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
答案 0 :(得分:1)
在你的JSON文件中,你有没有想过要包括你的"开始" value是您希望服务器在启动时执行的命令。对于节点,JSON的开头应如下所示:
{
"name": "deploying",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js"
希望这有帮助:)