【问题标题】:Netlify deploy Error: Cannot find module 'gatsby-plugin-image/graphql-utils'Netlify 部署错误:找不到模块“gatsby-plugin-image/graphql-utils”
【发布时间】:2021-05-02 22:24:34
【问题描述】:

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

非常感谢您的帮助。

【问题讨论】:

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


    【解决方案1】:

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

    node -v > nvmrc
    

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

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

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

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

    来源:

    【讨论】:

    • 感谢您的回复。可悲的是,我仍然得到相同的结果
    • 尝试升级或降级Node版本
    • 我降级了好几次,结果还是一样。我降级到的最后一个版本是 v12.18.0
    • 问题还是一样,只是换了推广的版本,不是吗?
    猜你喜欢
    • 1970-01-01
    • 2021-12-31
    • 2022-01-11
    • 1970-01-01
    • 1970-01-01
    • 2023-03-15
    • 2020-05-25
    • 2020-08-22
    • 1970-01-01
    相关资源
    最近更新 更多