我正在嘗試將反應應用程式推送到 heroku 服務器。我之前已經成功推送了一些反應應用程式,但現在它無法正常作業......這是我在運行此代碼時收到的錯誤訊息: git push heroku main
很多人說主分支 master 或 main 受到保護,我需要更改它,但我不知道在哪里可以做到這一點,它也沒有真正在我的 github 中創建存盤庫。
Total 47 (delta 0), reused 0 (delta 0), 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): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 16.x...
remote: Downloading and installing node 16.15.1...
remote: Using default npm version: 8.11.0
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote: npm ERR! code EUSAGE
remote: npm ERR!
remote: npm ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
remote: npm ERR!
remote: npm ERR! Invalid: lock file's [email protected] does not satisfy [email protected]
remote: npm ERR! Missing: [email protected] from lock file
remote: npm ERR! Invalid: lock file's [email protected] does not satisfy [email protected]
remote: npm ERR!
remote: npm ERR! Clean install a project
remote: npm ERR!
remote: npm ERR! Usage:
remote: npm ERR! npm ci
remote: npm ERR!
remote: npm ERR! Options:
remote: npm ERR! [--no-audit] [--foreground-scripts] [--ignore-scripts]
remote: npm ERR! [--script-shell <script-shell>]
remote: npm ERR!
remote: npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
remote: npm ERR!
remote: npm ERR! Run "npm help ci" for more info
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.qPgvy/_logs/2022-06-15T14_34_26_231Z-debug-0.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: Some possible problems:
remote:
remote: - Node version not specified in package.json
remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to test-this-deploy123.
remote:
To https://git.heroku.com/test-this-deploy123.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/test-this-deploy123.git'```
i looked everywhere but nothing has worked for me...
Can anybody please tell me what to do about this?!!?
uj5u.com熱心網友回復:
我將此添加到我的 package.json 并運行 npm install 并成功推送到heroku
"engines": {
"node": "16.13.2",
"npm": "8.1.2"
}
uj5u.com熱心網友回復:
不確定我的“答案”是否與您的原始問題相關,但就我而言,我在“npm ci”操作期間收到此錯誤(類似于您原始問題中的錯誤):
53 詳細堆疊錯誤: 53 詳細堆疊 `npm ci` 只能在您的 package.json 和 package-lock.json 或 npm-shrinkwrap.json 同步時安裝包。請在繼續之前使用 `npm install` 更新您的鎖定檔案。 53 詳細堆疊 53 詳細堆疊無效:鎖定檔案的 [email protected] 不滿足 [email protected] 53 詳細堆疊丟失:來自鎖定檔案的 [email protected] 53 詳細堆疊
我使用“silly”日志級別重新運行“npm install”操作,發現多個版本的 type-fest 作為依賴項安裝:
6817 愚蠢的審計 'type-fest': ['0.21.3', '0.8.1', '0.6.0', '0.3.1', '0.20.2' ],
但是,沒有安裝 0.13.1 版。此版本被列為“React Refresh Webpack 插件”(@pmmmwh/react-refresh-webpack-plugin)的對等依賴項。就我而言,我通過顯式添加解決了這個問題
“type-fest”:“^0.13.1”作為我的包的依賴項。也許不是解決它的最佳方法,但我已經花了太多時間試圖解決這個問題。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/493507.html
