Netlify 部署错误:找不到模块“gatsby-plugin-image/graphql-utils”

时间:2021-05-02 22:24:34

标签: node.js reactjs gatsby netlify gatsby-plugin

我尝试将站点部署到 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

非常感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

如您所说,当某些依赖仅在 Netlify 端失败时,99% 的情况是由于本地和 Netlify 环境之间的 Node 版本版本不匹配造成的。这是通过强制节点版本来解决的:

node -v > nvmrc

当 Netlify 找到 .nvmrc 文件时,它会尝试下载该版本以开始构建过程,这是完美的解决方法和修复缺失依赖项的方法。在您的情况下,无法满足 Node 版本(14.16.1),因此整个过程甚至无法启动。

Netlify 的部署系统在构建期间下载 Node 和 Node 包,这个问题主要与 Netlify 和 Cloudflare 之间的临时问题有关。

因此,如果您的应用程序在本地构建而没有任何问题,请不要惊慌,他们会很快解决问题。几小时后重试部署并检查 Netlify status pageCloudflare status page 以获取更多日志。

根据 Cloudflare 状态页面,他们似乎在全球某些服务器上遇到了问题。

来源: