我尝试将站点部署到Netlify,但遇到以下错误
10:22:38 PM: Error: Cannot find module 'gatsby-plugin-image/graphql-utils'我在这里查看并看到了运行此命令的解决方案
node -v > nvmrc我运行了该命令并开始了新的部署。在部署过程中出现了另一个错误
10:29:38 PM: Build ready to start
10:29:40 PM: build-image version: e4d2dbe4cfec46db257e869258461ded89b75c9b
10:29:40 PM: build-image tag: v3.7.3
10:29:40 PM: buildbot version: 2cb5794cb93042dadefe5dbdc6b35edc34c20454
10:29:40 PM: Fetching cached dependencies
10:29:40 PM: Failed to fetch cache, continuing with build
10:29:40 PM: Starting to prepare the repo for build
10:29:40 PM: No cached dependencies found. Cloning fresh repo
10:29:40 PM: git clone https://github.com/Dayropo/gatsby-exercise
10:29:41 PM: Preparing Git Reference refs/heads/master
10:29:42 PM: Parsing package.json dependencies
10:29:43 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
10:29:43 PM: Starting build script
10:29:43 PM: Installing dependencies
10:29:43 PM: Python version set to 2.7
10:29:43 PM: Attempting node version 'v14.16.1
' from .nvmrc
10:29:44 PM: Version 'v14.16.1
' not found - try `nvm ls-remote` to browse available versions.
10:29:44 PM: Failed to install node version 'v14.16.1
'
10:29:44 PM: Build was terminated: Build script returned non-zero exit code: 1
10:29:44 PM: Creating deploy upload records
10:29:44 PM: Failing build: Failed to build site
10:29:44 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
10:29:44 PM: Finished processing build request in 4.627825827s会非常感谢你的帮助。
发布于 2021-05-03 12:51:01
正如您所说,当一些依赖仅在Netlify端失败时,99%的情况是由于本地和Netlify环境之间的Node版本不匹配造成的。通过使用以下命令强制节点版本,可以修复此问题:
node -v > nvmrc当Netlify找到.nvmrc文件时,它会尝试下载该版本以开始构建过程,这是一个完美的变通方法,也是修复丢失的依赖项的方法。在您的例子中,节点版本无法满足(14.16.1),因此整个过程甚至无法启动。
Netlify的部署系统在构建时下载Node和Node包,这个问题主要与Netlify和Cloudflare之间的临时问题有关。
因此,如果您的应用程序在本地构建时没有任何问题,请不要惊慌,他们很快就会修复问题。几小时后重试部署,并检查Netlify status page或Cloudflare status page以获取更多日志。
根据Cloudflare的状态页面,他们似乎在全球的一些服务器上出现了问题。
资料来源:
https://stackoverflow.com/questions/67361635
复制相似问题