【发布时间】:2023-01-12 18:12:06
【问题描述】:
我已经更新了 NextJS,在更新它并在 Heroku 上推送更改后,我遇到了构建错误,在本地一切正常,我什至可以在不使用 -force 或 --legacy-peer-deps 命令的情况下安装所有 NPM。但是在部署时仍然遇到包问题。
-----> Building on the Heroku-22 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 16.15.0
engines.npm (package.json): 8.5.5
Resolving node version 16.15.0...
Downloading and installing node 16.15.0...
npm 8.5.5 already installed with node
-----> Restoring cache
- npm cache
-----> Installing dependencies
Installing node modules
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: isxy-prototype-next-scratch@undefined
npm ERR! Found: next@12.0.7
npm ERR! node_modules/next
npm ERR! next@"13.1.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! next@"13.1.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@18.2.0
npm ERR! node_modules/react
npm ERR! peer react@"^18.2.0" from next@13.1.1
npm ERR! node_modules/next
npm ERR! next@"13.1.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /tmp/npmcache.IAUlC/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.IAUlC/_logs/2023-01-11T06_56_44_322Z-debug-0.log
-----> Build failed
我曾尝试删除所有节点模块,清理缓存,然后尝试重新安装 npms。但仍然无法解决服务器上的这个问题
【问题讨论】:
标签: node.js heroku next.js deployment build-error