我想對托管在 heroku 上的 React.JS 網站進行更改,我按照以下步驟編輯我的網站:
運行git add .
運行git commit -m "make it better"
并最后運行git push origin main
收到錯誤后,我運行npm cache clean --force&npm i --force但無濟于事
然后我不斷收到以下錯誤:
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/nodejs
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.14.2...
remote: Using default npm version: 8.5.0
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 (package.json)
remote: npm ERR! code ERESOLVE
remote: npm ERR! ERESOLVE unable to resolve dependency tree
remote: npm ERR!
remote: npm ERR! While resolving: my-portfolio-website@0.1.0
remote: npm ERR! Found: @emotion/styled@11.8.1
remote: npm ERR! node_modules/@emotion/styled
remote: npm ERR! @emotion/styled@"^11.8.1" from the root project
remote: npm ERR!
remote: npm ERR! Could not resolve dependency:
remote: npm ERR! peer @emotion/styled@"^10.0.27" from @material-ui/styled-engine@5.0.0-alpha.11
remote: npm ERR! node_modules/@material-ui/styled-engine
remote: npm ERR! @material-ui/styled-engine@"^5.0.0-alpha.11" from the root project
remote: npm ERR!
remote: npm ERR! Fix the upstream dependency conflict, or retry
remote: npm ERR! this command with --force, or --legacy-peer-deps
remote: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
remote: npm ERR!
remote: npm ERR! See /tmp/npmcache.rdttK/eresolve-report.txt for a full report.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.rdttK/_logs/2022-03-21T08_48_10_190Z-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
編輯后,我想將我的更改推送到主分支。
uj5u.com熱心網友回復:
我猜您在構建應用程式時使用的是舊版本的 node.js,如果是這樣,請嘗試在package.json檔案中添加以下行:
"engines":
{
"node": "14.16.1",
"npm": "6.14.12"
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/451127.html
