Heroku应用程序部署失败,nodejs和flas

2024-06-16 22:11:11 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用一个引导模板,在这个模板上我添加了python和flask。当我尝试部署到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

我试着编辑我的包.json文件如下所示(在操作系统和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```



Tags: httpscomnodejsonapppackagenpmadmin