Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Heroku Procfile-运行npm启动_Node.js_Heroku_Npm - Fatal编程技术网

Node.js Heroku Procfile-运行npm启动

Node.js Heroku Procfile-运行npm启动,node.js,heroku,npm,Node.js,Heroku,Npm,package.json { //Other stuff here "scripts": { "prestart": "./scripts/prestart.sh", "start": "./scripts/start.sh" } } prestart.sh #!/usr/bin/env bash set -ex webpack start.sh #!/usr/bin/env bash set -ex http-server -p $PORT 程序文件 web

package.json

{
  //Other stuff here

  "scripts": {
    "prestart": "./scripts/prestart.sh",
    "start": "./scripts/start.sh"
  }
}
prestart.sh

#!/usr/bin/env bash
set -ex
webpack
start.sh

#!/usr/bin/env bash
set -ex
http-server -p $PORT
程序文件

web: npm start
当我推到heroku时,我得到一个应用程序错误。所以我运行了一个heroku run bash,并注意到在运行prestart调用webpack时根本没有运行prestart和start脚本,这将使用js文件创建一个生成的文件夹

有什么办法解决这个问题吗

编辑:

现在,当我将Webpack放在postinstall中时,它就可以工作了,而不是启动前

但http服务器不运行。当我运行heroku logs-tail时,我看不到http服务器的任何输出

heroku日志的输出-tail

如果您使用webpack构建应用程序,则应将其放入postinstall脚本中,而不是预启动,以便在构建时运行


当Heroku尝试启动你的应用程序时,npm start应该定期执行。要查看正在发生的情况,请查看heroku日志-tail。

Awesome+1。当我将网页包放入postinstall时,它现在正在运行,但仍然不确定它为什么不能在prestart中运行。此外,我没有看到正在运行的http服务器检查了日志并在框中运行了ps。
2015-06-23T18:05:55.628044+00:00 heroku[slug-compiler]: Slug compilation started
2015-06-23T18:05:55.628049+00:00 heroku[slug-compiler]: Slug compilation finished
2015-06-23T18:05:55.582057+00:00 heroku[api]: Deploy ** by ***
2015-06-23T18:05:55.582057+00:00 heroku[api]: Release v14 created by ****
2015-06-23T18:07:49.114534+00:00 heroku[api]: Starting process with command `bash` by ****
2015-06-23T18:07:54.748361+00:00 heroku[run.8851]: Starting process with command `bash`
2015-06-23T18:07:54.701235+00:00 heroku[run.8851]: Awaiting client
2015-06-23T18:07:54.808283+00:00 heroku[run.8851]: State changed from starting to up
2015-06-23T18:22:20.007391+00:00 heroku[run.8851]: State changed from up to complete
2015-06-23T18:22:19.997342+00:00 heroku[run.8851]: Process exited with status 0