python - Heroku 应用程序部署因 nodejs 和烧瓶而失败
问题描述
我正在使用一个引导模板,在该模板上添加了 python 和烧瓶。当我尝试部署到 Heroku 时,我得到的是:
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 10.x...
Downloading and installing node 10.15.3...
Using default npm version: 6.4.1
-----> Installing dependencies
Installing node modules (package.json)
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for startbootstrap-sb-admin-2@4.0.3: wanted {"os":"win32","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS: win32
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: linux
npm ERR! notsup Actual Arch: x64
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.uIdfz/_logs/2019-05-13T20_42_44_973Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- Node version not specified in package.json
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
我尝试如下编辑我的 package.json 文件(强调在os 和 arch中添加,因为以前没有。
{
"title": "SB Admin 2",
"name": "startbootstrap-sb-admin-2",
"version": "4.0.3",
**"os":"win32",
"arch":"any",**
"scripts": {
"start": "gulp watch"
},
"description": "An open source Bootstrap 4 admin theme.",
"keywords": [
"css",
"sass",
"html",
"responsive",
"theme",
"template",
"admin",
"app"
],
"homepage": "https://startbootstrap.com/template-overviews/sb-admin-2",
"bugs": {
"url": "https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/issues",
"email": "feedback@startbootstrap.com"
},
"license": "MIT",
"author": "Start Bootstrap",
"contributors": [
"David Miller (http://davidmiller.io/)"
],
"repository": {
"type": "git",
"url": "https://github.com/BlackrockDigital/startbootstrap-sb-admin-2.git"
},
"dependencies": {
"@fortawesome/fontawesome-free": "5.8.1",
"bootstrap": "4.3.1",
"chart.js": "2.8.0",
"datatables.net-bs4": "1.10.19",
"jquery": "^3.4.0",
"jquery.easing": "^1.4.1",
"npm-windows-upgrade": "^6.0.1"
},
"devDependencies": {
"browser-sync": "^2.26.4",
"del": "4.0.0",
"gulp": "4.0.0",
"gulp-autoprefixer": "6.0.0",
"gulp-clean-css": "4.0.0",
"gulp-header": "2.0.7",
"gulp-plumber": "^1.2.1",
"gulp-rename": "1.4.0",
"gulp-sass": "4.0.2",
"gulp-uglify": "3.0.2",
"merge-stream": "^1.0.1",
"react": "^16.8.6",
"react-dom": "^16.8.6"
}
}
但是,构建仍然失败。
有关其他信息,我已经添加了 heroku/nodejs 和 heroku/python buildpacks。另外,我的目录结构如下所示:
website
--static
--css
-- img
--js
--node_modules (this is ignored in .gitignore)
--scss
--vendor
--templates
--whole bunch of .html files as well as the gulpfile.js
--website_src
--bunch of .py files
.gitignore
__init__.py
app.py
environment.yml
package.json
Procfile --> web: gunicorn app:app
Procfile.windows --> web: gunicorn app:app
README.md
runtime.txt --> python-3.7.2```
解决方案
推荐阅读
- terraform - 如何获取 vsphere_virtual_machine 的 IP 来运行 ansible-playbook?
- python - 在没有数据库的情况下保存在 Django 中上传的文件
- javafx - 自动调整 javafx 大小时,TableView tableColumn 宽度不考虑标题
- c# - C#为什么TCPListener加载CPU
- javascript - 如何将输入值与现有数组连接起来
- python - 奇怪的字符串格式(来自 selenium scrape)仅在加入和拆分后出现
- javascript - Javascript函数在for循环第一次运行后返回未定义
- python - 为什么 print 函数没有在 Python 的字符串中给出剩余的输出
- python - Tensorflow Keras 对超过 30 个类别的图像分类准确率低
- reactjs - 如何为使用 laravel api 的反应项目生成元标记?