gpt4 book ai didi

javascript - 使用Python脚本的Heroku Node.js

转载 作者:太空宇宙 更新时间:2023-11-04 02:02:48 24 4
gpt4 key购买 nike

我在Heroku上运行了一个Node.js应用程序。我在其中添加了一些代码,以使其使用node-cmd运行Python(python3)脚本。所有这些都在本地工作。当我尝试将其部署到Heroku时,构建成功,但是应用程序未加载-应用程序错误提示:“应用程序中发生错误,无法为您的页面提供服务。如果您是应用程序所有者,请检查您的日志有关详细信息。”

我已经添加了Heroku和Node.js buildpacks:

heroku buildpacks:add heroku/python
heroku buildpacks:add heroku/nodejs


我的Procfile看起来像这样:

web: pip3 install -r requirements.txt & npm start


这是控制台输出:

Counting objects: 8, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 925 bytes | 0 bytes/s, done.
Total 8 (delta 4), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NPM_CONFIG_PRODUCTION=true
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote: engines.yarn (package.json): unspecified (use default)
remote:
remote: Resolving node version 6.x...
remote: Downloading and installing node 6.11.1...
remote: Using default npm version: 3.10.10
remote: Resolving yarn version (latest)...
remote: Downloading and installing yarn (0.28.1)...
remote: Installed yarn 0.28.1
remote:
remote: -----> Restoring cache
remote: Loading 2 from cacheDirectories (default):
remote: - node_modules
remote: - bower_components (not cached - skipping)
remote:
remote: -----> Building dependencies
remote: Installing node modules (yarn.lock)
remote: yarn install v0.28.1
remote: [1/4] Resolving packages...
remote: [2/4] Fetching packages...
remote: [3/4] Linking dependencies...
remote: [4/4] Building fresh packages...
remote: success Saved lockfile.
remote: Done in 4.95s.
remote:
remote: -----> Caching build
remote: Clearing previous node cache
remote: Saving 2 cacheDirectories (default):
remote: - node_modules
remote: - bower_components (nothing to cache)
remote:
remote: -----> Build succeeded!
remote: -----> Python app detected
remote: -----> Installing python-3.6.2
remote: -----> Installing pip
remote: -----> Installing requirements with pip


[安装程序包]

remote:        Successfully installed Keras-2.0.6 Markdown-2.6.8 PyMySQL-0.7.11 PyYAML-3.12 SQLAlchemy-1.1.12 Theano-0.9.0 Werkzeug-0.12.2 backports.weakref-1.0rc1 bleach-1.5.0 configparser-3.5.0 h5py-2.7.0 html5lib-0.9999999 mysqlclient-1.3.10 numpy-1.13.1 pandas-0.20.3 protobuf-3.3.0 python-dateutil-2.6.1 pytz-2017.2 scikit-learn-0.18.2 scipy-0.19.1 six-1.10.0 sklearn-0.0 tensorflow-1.2.1
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 235.4M
remote: -----> Launching...
remote: Released v17
remote: https://fathomless-temple-41546.herokuapp.com/ deployed to Herok
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/fathomless-temple-41546.git
3ed0799..e16fb12 master -> master


有什么我想念的吗?

最佳答案

heroku buildpacks:add heroku/python
heroku buildpacks:add heroku/nodejs
heroku ps:scale web=1


我得到一个 Scaling dynos... !
▸ Couldn't find that process type (web).

运行 scale web=1时发生错误,我通过使用 web: bundle exec node app -p $PORT临时添加Procfile并在从应用程序中删除Procfile之前再次运行它来解决此问题。

关于javascript - 使用Python脚本的Heroku Node.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45392435/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com