微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

heroku 部署问题 - 错误:无法将一些引用推送到

如何解决heroku 部署问题 - 错误:无法将一些引用推送到

这很好,直到我向我的客户端添加一个服务器,该服务器运行 buildpacks mars/... 我确保使用 buildpacks 删除所有 buildpacks:remove mars/... 我也试过 heroku buildpacks:set heroku/nodejs 我也试过 git push heroku main:main

我不确定,但我认为这可能是权限问题,但我可能错了,因为我是 Heroku 的新手。

git push heroku main
Enumerating objects: 74,done.
Counting objects: 100% (74/74),done.
Delta compression using up to 12 threads
Compressing objects: 100% (53/53),done.
Writing objects: 100% (68/68),290.70 KiB | 58.14 MiB/s,done.
Total 68 (delta 15),reused 62 (delta 13),pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONfig_LOGLEVEL=error
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 12.16.2
remote: engines.npm (package.json): 6.14.6
remote:
remote: Resolving node version 12.16.2...
remote: Downloading and installing node 12.16.2...
remote: Bootstrapping npm 6.14.6 (replacing 6.14.4)...
remote: npm 6.14.6 installed
remote:
remote: -----> Restoring cache
remote: Cached directories were not restored due to a change in version of node,npm,yarn or stack
remote: Module installation may take longer for this build
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote:
remote: > fsevents@1.2.13 install /tmp/build_ff6289e7/node_modules/fsevents
remote: > node install.js
remote:
remote:
remote: Skipping 'fsevents' build as platform linux is not supported
remote:
remote: > nodemon@1.19.4 postinstall /tmp/build_ff6289e7/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 375 packages in 6.258s
remote:
remote: -----> Build
remote: Detected both "build" and "heroku-postbuild" scripts
remote: Running heroku-postbuild
remote:
remote: > everestminds-task@1.0.0 heroku-postbuild /tmp/build_ff6289e7
remote: > cd client && npm install && npm install --only=dev --no-shrinkwrap && npm run build
remote:
remote:
remote: > node-sass@6.0.1 install /tmp/build_ff6289e7/client/node_modules/node-sass
remote: > node scripts/install.js
remote:
remote: Downloading binary from https://github.com/sass/node-sass/releases/download/v6.0.1/linux-x64-72_binding.node
remote: Download complete
remote: Binary saved to /tmp/build_ff6289e7/client/node_modules/node-sass/vendor/linux-x64-72/binding.node
remote: Caching binary to /tmp/npmcache.vnweW/node-sass/6.0.1/linux-x64-72_binding.node
remote:
remote: > core-js@3.6.5 postinstall /tmp/build_ff6289e7/client/node_modules/@firebase/polyfill/node_modules/core-js
remote: > node -e "try{require('./postinstall')}catch(e){}"
remote:
remote:
remote: > core-js@2.6.12 postinstall /tmp/build_ff6289e7/client/node_modules/babel-runtime/node_modules/core-js
remote: > node -e "try{require('./postinstall')}catch(e){}"
remote:
remote:
remote: > core-js@3.14.0 postinstall /tmp/build_ff6289e7/client/node_modules/core-js
remote: > node -e "try{require('./postinstall')}catch(e){}"
remote:
remote:
remote: > core-js-pure@3.14.0 postinstall /tmp/build_ff6289e7/client/node_modules/core-js-pure
remote: > node -e "try{require('./postinstall')}catch(e){}"
remote:
remote:
remote: > ejs@2.7.4 postinstall /tmp/build_ff6289e7/client/node_modules/ejs
remote: > node ./postinstall.js
remote:
remote:
remote: > protobufjs@6.11.2 postinstall /tmp/build_ff6289e7/client/node_modules/protobufjs
remote: > node scripts/postinstall
remote:
remote:
remote: > node-sass@6.0.1 postinstall /tmp/build_ff6289e7/client/node_modules/node-sass
remote: > node scripts/build.js
remote:
remote: Binary found at /tmp/build_ff6289e7/client/node_modules/node-sass/vendor/linux-x64-72/binding.node
remote: Testing binary
remote: Binary is fine
remote: added 2146 packages from 876 contributors and audited 2150 packages in 55.156s
remote:
remote: 151 packages are looking for funding
remote: run npm fund for details
remote:
remote: found 7 vulnerabilities (3 moderate,4 high)
remote: run npm audit fix to fix them,or npm audit for details
remote: audited 2150 packages in 14.59s
remote:
remote: 151 packages are looking for funding
remote: run npm fund for details
remote:
remote: found 7 vulnerabilities (3 moderate,or npm audit for details
remote:
remote: > everestminds-task@0.1.0 build /tmp/build_ff6289e7/client
remote: > react-scripts build
remote:
remote: Creating an optimized production build...
remote: Failed to compile.
remote:
remote: Can't find self.__WB_MANIFEST in your SW source.
remote:
remote:
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! everestminds-task@0.1.0 build: react-scripts build
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the everestminds-task@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.vnweW/_logs/2021-06-27T21_07_28_897Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! everestminds-task@1.0.0 heroku-postbuild: cd client && npm install && npm install --only=dev --no-shrinkwrap && npm run build
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the everestminds-task@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.vnweW/_logs/2021-06-27T21_07_28_915Z-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 Node.js app.
remote:
remote: ! Push Failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: 2c4fee55f03ca310626cd12afa9d269f1d95cc34
remote: !
remote: ! We have detected that you have triggered a build from source code with version 2c4fee55f03ca310626cd12afa9d269f1d95cc34
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 :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 everestminds-task.
remote:
To https://git.heroku.com/everestminds-task.git
! [remote rejected] main -> main (pre-receive hook declined)
error: Failed to push some refs to 'https://git.heroku.com/everestminds-task.git'

服务器包.json

{
  "name": "everestminds-task","version": "1.0.0","engines": {
    "node": "12.16.2","npm": "6.14.6"
  },"scripts": {
    "client": "cd client && npm start","server": "nodemon server.js","build": "cd client && npm run build","dev": "concurrently --kill-others-on-fail \"npm run server\" \"npm run client\"","start": "node server.js","heroku-postbuild": "cd client && npm install && npm install --only=dev --no-shrinkwrap && npm run build"
  },"dependencies": {
    "body-parser": "^1.18.3","cors": "2.8.5","dotenv": "7.0.0","express": "^4.16.4","stripe": "6.28.0"
  },"devDependencies": {
    "concurrently": "^4.0.1","nodemon": "^1.19.1"
  }
}

客户端 package.json

{
  "name": "everestminds-task","version": "0.1.0","private": true,"proxy": "http://localhost:5000","dependencies": {
    "@testing-library/jest-dom": "^5.14.1","@testing-library/react": "^11.2.7","@testing-library/user-event": "^12.8.3","axios": "^0.21.1","express-sslify": "^1.2.0","firebase": "^8.6.8","node-sass": "^6.0.1","react": "^17.0.2","react-dom": "^17.0.2","react-redux": "^7.2.4","react-router-dom": "^5.2.0","react-scripts": "4.0.3","react-stripe-checkout": "^2.6.3","redux": "^4.1.0","redux-logger": "^3.0.6","redux-persist": "^6.0.0","reselect": "^4.0.0","styled-components": "^5.3.0","web-vitals": "^1.1.2"
  },"scripts": {
    "start": "react-scripts start","build": "react-scripts build","test": "react-scripts test","eject": "react-scripts eject"
  },"eslintConfig": {
    "extends": [
      "react-app","react-app/jest"
    ]
  },"browserslist": {
    "production": [
      ">0.2%","not dead","not op_mini all"
    ],"development": [
      "last 1 chrome version","last 1 firefox version","last 1 safari version"
    ]
  }
}

提前感谢您的帮助

解决方法

好的,对于遇到此问题的任何人。我发现了问题,是serviceworker.js ......似乎“在你的软件源中找不到self.__WB_MANIFEST”与它有关。

create-react-app 不再带有 service-worker.js。所以可能我需要安装一个“swSrc”或我还不确定的包。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。