首页 > 解决方案 > 在heroku中部署我的项目。我的应用程序在本地运行良好,但在部署时它崩溃了

问题描述

    enter code here

**

**

   C:\Users\My PC\Desktop\cloth-app>git push heroku master
    Enumerating objects: 37595, done.
    Counting objects: 100% (37595/37595), done.
    Delta compression using up to 4 threads
    Compressing objects: 100% (27459/27459), done.
    Writing objects: 100% (37595/37595), 50.79 MiB | 86.00 KiB/s, done.
    Total 37595 (delta 8403), reused 37580 (delta 8397), pack-reused 0
    remote: Compressing source files... done.
    remote: Building source:
    remote:
    remote: -----> React.js (create-react-app) multi app detected
    remote: =====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-multi.git
    remote: =====> Detected Framework: Multipack
    remote: =====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-nodejs.git
    remote: =====> Detected Framework: Node.js
    remote:
    remote: -----> Creating runtime environment
    remote:
    remote:        NPM_CONFIG_LOGLEVEL=error
    remote:        NODE_ENV=production
    remote:        NODE_MODULES_CACHE=true
    remote:        NODE_VERBOSE=false
    remote:
    remote: -----> Installing binaries
    remote:        engines.node (package.json):  12.18.1
    remote:        engines.npm (package.json):   6.14.5
    remote:
    remote:        Resolving node version 12.18.1...
    remote:        Downloading and installing node 12.18.1...
    remote:        npm 6.14.5 already installed with node
    remote:
    remote: -----> Installing dependencies
    remote:        Installing node modules
    remote:
    remote:        > nodemon@2.0.6 postinstall /tmp/build_5f5304d1/node_modules/nodemon
    remote:        > node bin/postinstall || exit 0
    remote:
    remote:        Love nodemon? You can now support the project via the open collective:
    remote:         > https://opencollective.com/nodemon/donate
    remote:
    remote:        added 268 packages in 5.208s
    remote:
    remote: -----> Build
    remote:        Detected both "build" and "heroku-postbuild" scripts
    remote:        Running heroku-postbuild
    remote:
    remote:        > cloth-app-server@1.0.0 heroku-postbuild /tmp/build_5f5304d1
    remote:        > cd client && npm install && npm install --only=dev --no-shrinkwrap && npm run build
    remote:
    remote:        audited 2097 packages in 17.793s
    remote:
    remote:        119 packages are looking for funding
    remote:          run `npm fund` for details
    remote:
    remote:        found 0 vulnerabilities
    remote:
    remote:        audited 2098 packages in 15.157s
    remote:
    remote:        119 packages are looking for funding
    remote:          run `npm fund` for details
    remote:
    remote:        found 0 vulnerabilities
    remote:
    remote:
    remote:        > cloth-app@0.1.0 build /tmp/build_5f5304d1/client
    remote:        > react-scripts build
    remote:
    remote: 
 
    remote:sh: 1: react-scripts: Permission denied
    remote: npm ERR! code ELIFECYCLE
    remote: npm ERR! errno 126
    remote: npm ERR! cloth-app@0.1.0 build: `react-scripts build`
    remote: npm ERR! Exit status 126
    remote: npm ERR!
    remote: npm ERR! Failed at the cloth-app@0.1.0 build script.
    remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    remote:
    remote: npm ERR! A complete log of this run can be found in:
    remote: npm ERR!     /tmp/npmcache.Hb9pQ/_logs/2020-11-29T17_00_20_934Z-debug.log
    remote: npm ERR! code ELIFECYCLE
    remote: npm ERR! errno 126
    remote: npm ERR! cloth-app-server@1.0.0 heroku-postbuild: `cd client && npm install && npm 
            install --only=dev --no-shrinkwrap && npm ru
    n build`
    remote: npm ERR! Exit status 126
    remote: npm ERR!
    remote: npm ERR! Failed at the cloth-app-server@1.0.0 heroku-postbuild script.
    remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    remote:
    remote: npm ERR! A complete log of this run can be found in:
    remote: npm ERR!     /tmp/npmcache.Hb9pQ/_logs/2020-11-29T17_00_20_948Z-debug.log
    remote:
    remote: -----> Build failed
    remote:
    remote:        We're sorry this build is failing! You can troubleshoot common issues here:
    remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
    remote:
    remote:        If you're stuck, please submit a ticket so we can help:
    remote:        https://help.heroku.com/
    remote:
    remote:        Love,
    remote:        Heroku
    remote:
    remote:  !     Push rejected, failed to compile React.js (create-react-app) multi app.
    remote:
    remote:  !     Push failed

警告 - 此代码的相同版本已经构建:

             b0343f5ec830fbc6a90f86fcc2690651a771585a
    remote:  !
    remote:  ! ## Warning - The same version of this code has already been built: 
             b0343f5ec830fbc6a90f86fcc2690651a771585a
    remote:  !
    remote:  ! We have detected that you have triggered a build from source code with version 
               b0343f5ec830fbc6a90f86fcc2690651a771585a
    remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a 
             different branch.
    remote:  !
    remote:  ! If you are developing on a branch and deploying via git you must run:
    remote:  !
    remote:  !     git push heroku <branchname>:main
    remote:  !
    remote:  ! This article goes into details on the behavior:
    remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
    remote:
    remote: Verifying deploy...
    remote:
    remote: !       Push rejected to aj-clothing.
    remote:
    To https://git.heroku.com/aj-clothing.git
 
! [remote rejected]   master -> master (pre-receive hook declined)
    error: failed to push some refs to 'https://git.heroku.com/aj-clothing.git'

标签: node.jsgitgithubherokunpm

解决方案


我只是重新安装节点包。求帮助


推荐阅读