这是netlify生成日志中失败的生成日志。我昨天造的。现在我在建设这个网站上遇到了问题
10:16:47 AM: Starting build script
10:16:47 AM: Installing dependencies
10:16:47 AM: Python version set to 2.7
10:16:47 AM: Downloading and installing node v16.15.1...
10:16:47 AM: Downloading https://nodejs.org/dist/v16.15.1/node-v16.15.1-linux-x64.tar.xz...
10:16:48 AM: Computing checksum with sha256sum
10:16:48 AM: Checksums matched!
10:16:51 AM: Now using node v16.15.1 (npm v8.11.0)
10:16:51 AM: Started restoring cached build plugins
10:16:51 AM: Finished restoring cached build plugins
10:16:51 AM: Attempting ruby version 2.7.2, read from environment
10:16:52 AM: Using ruby version 2.7.2
10:16:52 AM: Using PHP version 8.0
10:16:53 AM: No npm workspaces detected
10:16:53 AM: Started restoring cached node modules
10:16:53 AM: Finished restoring cached node modules
10:16:53 AM: Installing NPM modules using NPM version 8.11.0
10:16:54 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
10:16:54 AM: npm WARN config location in the cache, and they are managed by
10:16:54 AM: npm WARN config [`cacache`](http://npm.im/cacache).
10:16:54 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
10:16:54 AM: npm WARN config location in the cache, and they are managed by
10:16:54 AM: npm WARN config [`cacache`](http://npm.im/cacache).
10:16:56 AM: npm ERR! code ERESOLVE
10:16:56 AM: npm ERR! ERESOLVE could not resolve
10:16:56 AM: npm ERR!
10:16:56 AM: npm ERR! While resolving: react-reveal@1.2.2
10:16:56 AM: Creating deploy upload records
10:16:56 AM: npm ERR! Found: react@17.0.2
10:16:56 AM: npm ERR! node_modules/react
10:16:56 AM: npm ERR! react@"^17.0.2" from the root project
10:16:56 AM: npm ERR! peer react@">= 16.8.0" from @formspree/react@2.2.4
10:16:56 AM: npm ERR! node_modules/@formspree/react
10:16:57 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
10:16:56 AM: npm ERR! @formspree/react@"^2.2.4" from the root project
10:16:56 AM: npm ERR! 8 more (@testing-library/react, react-dom, react-icons, ...)
10:16:56 AM: npm ERR!
10:16:56 AM: npm ERR! Could not resolve dependency:
10:16:56 AM: npm ERR! peer react@"^15.3.0 || ^16.0.0" from react-reveal@1.2.2
10:16:56 AM: npm ERR! node_modules/react-reveal
10:16:56 AM: npm ERR! react-reveal@"^1.2.2" from the root project
10:16:56 AM: npm ERR!
10:16:56 AM: npm ERR! Conflicting peer dependency: react@16.14.0
10:16:56 AM: npm ERR! node_modules/react
10:16:56 AM: npm ERR! peer react@"^15.3.0 || ^16.0.0" from react-reveal@1.2.2
10:16:56 AM: npm ERR! node_modules/react-reveal
10:16:56 AM: npm ERR! react-reveal@"^1.2.2" from the root project
10:16:56 AM: npm ERR!
10:16:56 AM: npm ERR! Fix the upstream dependency conflict, or retry
10:16:56 AM: npm ERR! this command with --force, or --legacy-peer-deps
10:16:56 AM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
10:16:56 AM: npm ERR!
10:16:56 AM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
10:16:56 AM: npm ERR! A complete log of this run can be found in:
10:16:56 AM: npm ERR! /opt/buildhome/.npm/_logs/2022-06-14T04_16_54_367Z-debug-0.log
10:16:56 AM: Error during NPM install
10:16:56 AM: Build was terminated: Build script returned non-zero exit code: 1
10:16:57 AM: Failing build: Failed to build site
10:16:57 AM: Finished processing build request in 13.567112014s我猜这可能是为了国家预防机制。是否应该删除已安装的依赖项,并再次使用-强制标志重新安装它们?我正在使用npm版本8。我如何解决这个问题?
发布于 2022-06-14 19:35:42
在部署到Netlify时,我也面临着同样的问题,所有对我的PRs的检查都失败了。在搜索了一下之后,在这里的Netlify论坛上找到了这个解决方案- 版本修正被终止:生成脚本返回非零退出代码:1
在我的例子中,我能够通过在build命令之后添加-force npm run build --force标志来解决问题。此外,必须在Netlify中将NODE_VERSION env变量设置为16.15.0,因为该问题显然发生在Node 16.15.1中,而该版本正是用于构建的版本。
你在帖子里提到的那个节点版本-
10:16:51 AM:现在使用节点v16.15.1 (npm v8.11.0)
如果我使用的链接对您不起作用,那么在上面提供的链接中也很少提到其他解决方案。
https://stackoverflow.com/questions/72611536
复制相似问题