Gatsby 在 Netlify 部署上构建失败

2024-01-17

我的网站是使用 Gatsby 构建的,并持续部署到 Netlify。我已经两个月没有碰过我的盖茨比网站了。因此,当我运行更新并添加新内容并部署时,我在 Netlify 构建上遇到了重大错误。

尝试了很多事情并花了太多时间。最初我只使用 npm。经过一段时间的研究后,我按照一些在线线程的建议转向了纱线。现在使用yarn 收到了不同的错误消息,但部署到Netlify 仍然没有成功。

这可能是一件愚蠢而简单的事情。我知道我之前遇到过部署/构建问题并修复了它们,但是......此时我不知所措......

  1. 我的本地构建确实有效。没有问题,本地的gatsby develop and gatsby build两者都有效。
  2. 我已经运行了所有可能的纱线升级。
  3. The problem seems to be one of these (maybe):
    1. 要么是 Sass 文件未正确构建并导致整个文件崩溃,要么
    2. Netlify 认为/看到 gatsby-cli 未安装,因此无法运行gatsby build command
  4. Site repo is now public: https://github.com/heyspacetime/spacetime-gatsby https://github.com/heyspacetime/spacetime-gatsby
    1. master and switch-to-yarn树枝一团糟。正在从事PR #58 https://github.com/heyspacetime/spacetime-gatsby/pull/58解决这个部署问题

注意:我也将其发布到 Reddit:https://www.reddit.com/r/gatsbyjs/comments/bnfqij/help_netlify_deploy_fails_on_gatsby_build/ https://www.reddit.com/r/gatsbyjs/comments/bnfqij/help_netlify_deploy_fails_on_gatsby_build/

切换到 Yarn 后部署错误

以下是尝试在 Netlify 上构建后的部署详细信息。我在代码块后面链接了一个屏幕截图,以便您可以看到错误突出显示。

10:42:15 PM: Build ready to start
10:42:18 PM: build-image version: 8e315e54bc4032a32e73290be556cde4f8348c12
10:42:18 PM: build-image tag: v2.8.2
10:42:18 PM: buildbot version: 1c5d5da2a8a19e94f07a53f82f5c9b010bad1249
10:42:18 PM: Fetching cached dependencies
10:42:18 PM: Failed to fetch cache, continuing with build
10:42:18 PM: Starting to prepare the repo for build
10:42:18 PM: No cached dependencies found. Cloning fresh repo
10:42:18 PM: git clone [email protected] /cdn-cgi/l/email-protection:heyspacetime/spacetime-gatsby
10:42:22 PM: Preparing Git Reference pull/58/head
10:42:22 PM: Found netlify.toml. Overriding site configuration
10:42:22 PM: Starting build script
10:42:22 PM: Installing dependencies
10:42:23 PM: Downloading and installing node v8.16.0...
10:42:23 PM: Downloading https://nodejs.org/dist/v8.16.0/node-v8.16.0-linux-x64.tar.xz...
10:42:24 PM:                    0.3%
10:42:24 PM: 
###########
10:42:24 PM:                                      16.3%
10:42:24 PM: 
##########################################################
10:42:24 PM:             81.6%
10:42:24 PM: 
#######################################
10:42:24 PM: ################################# 100.0%
10:42:24 PM: Computing checksum with sha256sum
10:42:24 PM: Checksums matched!
10:42:26 PM: Now using node v8.16.0 (npm v6.4.1)
10:42:26 PM: Attempting ruby version 2.3.6, read from environment
10:42:27 PM: Using ruby version 2.3.6
10:42:28 PM: Using PHP version 5.6
10:42:28 PM: Started restoring cached node modules
10:42:28 PM: Finished restoring cached node modules
10:42:28 PM: Started restoring cached yarn cache
10:42:28 PM: Finished restoring cached yarn cache
10:42:28 PM: Installing yarn at version 1.5.1
10:42:28 PM: Installing Yarn!
10:42:28 PM: > Downloading tarball...
10:42:28 PM: [1/2]: https://yarnpkg.com/downloads/1.5.1/yar
10:42:28 PM: n-v1.5.1.tar.gz --> /tmp/yarn.tar.gz.unnZulZpgP
10:42:28 PM:   % Total    % Recei
10:42:28 PM: ved % Xferd  Average Speed   Time    Time     Time  Curr
10:42:28 PM: ent
10:42:28 PM:          Dload  Upload   Total   Spent
10:42:28 PM:  Left  Speed
10:42:28 PM: 
  0
10:42:28 PM: 0    0     0    0     0      0      0 --:--:-- --:-
10:42:28 PM: -:-- --:--:--     0
10:42:28 PM: 
100    91  100    91    0     0    511
10:42:28 PM:     0 --:--:-- --:--:-- --:--:--   514
10:42:28 PM: 
  0     0    0   608    0     0   1591      0 --:
10:42:28 PM: --:-- --:--:-- --:--:--  1591
10:42:28 PM: 
100  914k  100  914k    0     0  1226k      0 --:--:-- --:-
10:42:28 PM: -:-- --:--:-- 1226k
10:42:28 PM: [2/2]: https://yarnpkg.co
10:42:28 PM: m/downloads/1.5.1/yarn-v1.5.1.tar.gz.asc --> /tmp/yarn.tar.gz.unnZ
10:42:28 PM: ulZpgP.asc
10:42:29 PM: 
100    95  100    95    0     0   2061      0 --:--:-
10:42:29 PM: - --:--:-- --:--:--  2061
10:42:29 PM: 
  0     0    0   612    0     0   3939
10:42:29 PM:    0 --:--:-- --:--:-- --:--:--  3939
10:42:29 PM: 
  0   832    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
10:42:29 PM: 
100   832  100   832    0     0   3750
10:42:29 PM:       0 --:--:-- --:--:-- --:--:--  812k
10:42:29 PM: > Verifying integrity...
10:42:29 PM: gpg: Signature made Mon 26 Feb 2018 07:01:19 PM UTC using RSA key ID B6FF4DE3
10:42:29 PM: gpg: Good signature from "Yarn Packaging <[email protected] /cdn-cgi/l/email-protection>"
10:42:29 PM: gpg: Note: This key has expired!
10:42:29 PM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907  BBB7 1646 B01B 86E5 0310
10:42:29 PM:      Subkey fingerprint: E219 30C4 D0A4 AA46 1858  1F7A E074 D16E B6FF 4DE3
10:42:29 PM: > GPG signature looks good
10:42:29 PM: > Extracting to ~/.yarn...
10:42:29 PM: > Adding to $PATH...
10:42:29 PM: > We've added the following to your /opt/buildhome/.profile
10:42:29 PM: > If this isn't the profile of your current shell then please add the following to your correct profile:
10:42:29 PM: export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
10:42:29 PM: 
10:42:30 PM: > Successfully installed Yarn 1.5.1! Please open another terminal where the `yarn` command will now be available.
10:42:30 PM: Installing NPM modules using Yarn version 1.5.1
10:42:31 PM: yarn install v1.5.1
10:42:31 PM: [1/4] Resolving packages...
10:42:33 PM: [2/4] Fetching packages...
10:42:55 PM: info [email protected] /cdn-cgi/l/email-protection: The platform "linux" is incompatible with this module.
10:42:55 PM: info "[email protected] /cdn-cgi/l/email-protection" is an optional dependency and failed compatibility check. Excluding it from installation.
10:42:55 PM: [3/4] Linking dependencies...
10:42:55 PM: warning " > [email protected] /cdn-cgi/l/email-protection" has incorrect peer dependency "[email protected] /cdn-cgi/l/email-protection".
10:42:55 PM: warning "gatsby > pnp-webpack-plugin > [email protected] /cdn-cgi/l/email-protection" has unmet peer dependency "typescript@*".
10:42:55 PM: warning "gatsby-plugin-transition-link > babel-preset-gatsby-package > @babel/[email protected] /cdn-cgi/l/email-protection" has unmet peer dependency "@babel/core@^7.0.0-0".
10:42:55 PM: warning "gatsby-plugin-transition-link > babel-preset-gatsby-package > @babel/[email protected] /cdn-cgi/l/email-protection" has unmet peer dependency "@babel/core@^7.0.0-0".
10:42:55 PM: warning "gatsby-plugin-transition-link > babel-preset-gatsby-package > @babel/plugin-proposal-optional-chaining > @babel/[email protected] /cdn-cgi/l/email-protection" has unmet peer dependency "@babel/core@^7.0.0-0".
10:43:05 PM: [4/4] Building fresh packages...
10:43:12 PM: success Saved lockfile.
10:43:12 PM: Done in 41.23s.
10:43:12 PM: NPM modules installed using Yarn
10:43:12 PM: Started restoring cached go cache
10:43:12 PM: Finished restoring cached go cache
10:43:12 PM: Installing Go version 1.10
10:43:18 PM: unset GOOS;
10:43:18 PM: unset GOARCH;
10:43:18 PM: export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.10.linux.amd64';
10:43:18 PM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.10.linux.amd64/bin:${PATH}";
10:43:18 PM: go version >&2;
10:43:18 PM: export GIMME_ENV="/opt/buildhome/.gimme_cache/env/go1.10.linux.amd64.env"
10:43:18 PM: go version go1.10 linux/amd64
10:43:18 PM: Installing missing commands
10:43:18 PM: Verify run directory
10:43:18 PM: Executing user command: npm run build
10:43:18 PM: > [email protected] /cdn-cgi/l/email-protection build /opt/build/repo
10:43:18 PM: > gatsby build
10:43:20 PM: success open and validate gatsby-configs — 0.011 s
10:43:21 PM: success load plugins — 1.030 s
10:43:21 PM: success onPreInit — 0.118 s
10:43:21 PM: success delete html and css files from previous builds — 0.005 s
10:43:21 PM: success initialize cache — 0.008 s
10:43:21 PM: success copy gatsby files — 0.022 s
10:43:21 PM: success onPreBootstrap — 0.004 s
10:43:22 PM: success source and transform nodes — 0.413 s
10:43:22 PM: success building schema — 0.226 s
10:43:22 PM: success createPages — 0.018 s
10:43:22 PM: success createPagesStatefully — 0.072 s
10:43:22 PM: success onPreExtractQueries — 0.002 s
10:43:22 PM: success update schema — 0.024 s
10:43:22 PM: success extract queries from components — 0.078 s
10:43:22 PM: success run static queries — 0.001 s
10:43:22 PM: success run page queries — 0.019 s — 20/20 1114.65 queries/second
10:43:22 PM: success write out page data — 0.006 s
10:43:22 PM: success write out redirect data — 0.001 s
10:43:23 PM: success Build manifest and related icons — 0.776 s
10:43:23 PM: success onPostBootstrap — 0.778 s
10:43:23 PM: info bootstrap finished - 5.200 s
10:43:42 PM: error Generating JavaScript bundles failed
10:43:42 PM: 
10:43:42 PM:   Error: ./src/assets/stylesheets/styles.scss
10:43:42 PM:   Module build failed (from ./node_modules/gatsby/node_modules/mini-css-extract-  plugin/dist/loader.js):
10:43:42 PM:   ModuleBuildError: Module build failed (from ./node_modules/sass-loader/lib/loa  der.js):
10:43:42 PM:   Error: ENOENT: no such file or directory, scandir '/opt/build/repo/node_module  s/node-sass/vendor'
10:43:42 PM:       at Object.fs.readdirSync (fs.js:904:18)
10:43:42 PM:       at Object.getInstalledBinaries (/opt/build/repo/node_modules/node-sass/lib  /extensions.js:131:13)
10:43:42 PM:       at foundBinariesList (/opt/build/repo/node_modules/node-sass/lib/errors.js  :20:15)
10:43:42 PM:       at foundBinaries (/opt/build/repo/node_modules/node-sass/lib/errors.js:15:  5)
10:43:42 PM:       at Object.module.exports.missingBinary (/opt/build/repo/node_modules/node-  sass/lib/errors.js:45:5)
10:43:42 PM:       at module.exports (/opt/build/repo/node_modules/node-sass/lib/binding.js:1  5:30)
10:43:42 PM:       at Object.<anonymous> (/opt/build/repo/node_modules/node-sass/lib/index.js  :14:35)
10:43:42 PM:       at Module._compile (/opt/build/repo/node_modules/v8-compile-cache/v8-compi  le-cache.js:178:30)
10:43:42 PM:       at Object.Module._extensions..js (module.js:664:10)
10:43:42 PM:       at Module.load (module.js:566:32)
10:43:42 PM:       at tryModuleLoad (module.js:506:12)
10:43:42 PM:       at Function.Module._load (module.js:498:3)
10:43:42 PM:       at Module.require (module.js:597:17)
10:43:42 PM:       at require (/opt/build/repo/node_modules/v8-compile-cache/v8-compile-cache  .js:159:20)
10:43:42 PM:       at Object.sassLoader (/opt/build/repo/node_modules/sass-loader/lib/loader.  js:46:72)
10:43:42 PM:       at runLoaders (/opt/build/repo/node_modules/gatsby/node_modules/webpack/li  b/NormalModule.js:301:20)
10:43:42 PM:       at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:367:11
10:43:42 PM:       at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:233:18
10:43:42 PM:       at runSyncOrAsync (/opt/build/repo/node_modules/loader-runner/lib/LoaderRu  nner.js:143:3)
10:43:42 PM:       at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/Lo  aderRunner.js:232:2)
10:43:42 PM:       at Array.<anonymous> (/opt/build/repo/node_modules/loader-runner/lib/Loade  rRunner.js:205:4)
10:43:42 PM:       at Storage.finished (/opt/build/repo/node_modules/enhanced-resolve/lib/Cac  hedInputFileSystem.js:43:16)
10:43:42 PM:       at provider (/opt/build/repo/node_modules/enhanced-resolve/lib/CachedInput  FileSystem.js:79:9)
10:43:42 PM:       at /opt/build/repo/node_modules/graceful-fs/graceful-fs.js:90:16
10:43:42 PM:       at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
10:43:42 PM:    @ ./src/components/layout.js 6:0-43
10:43:42 PM:    @ ./src/pages/services/technical-seo.js
10:43:42 PM:    @ ./.cache/async-requires.js
10:43:42 PM:    @ ./.cache/production-app.js
10:43:42 PM: 
10:43:42 PM: npm
10:43:42 PM:  ERR! code ELIFECYCLE
10:43:42 PM: npm ERR!
10:43:42 PM:  errno 1
10:43:42 PM: npm
10:43:42 PM:  ERR! [email protected] /cdn-cgi/l/email-protection build: `gatsby build`
10:43:42 PM: npm ERR! Exit status 1
10:43:42 PM: npm ERR!
10:43:42 PM: npm ERR! Failed at the [email protected] /cdn-cgi/l/email-protection build script.
10:43:42 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
10:43:43 PM: npm
10:43:43 PM: ERR! A complete log of this run can be found in:
10:43:43 PM: npm ERR!     /opt/buildhome/.npm/_logs/2019-05-11T03_43_42_997Z-debug.log
10:43:43 PM: Skipping functions preparation step: no functions directory set
10:43:43 PM: Caching artifacts
10:43:43 PM: Started saving node modules
10:43:43 PM: Finished saving node modules
10:43:43 PM: Started saving yarn cache
10:43:43 PM: Finished saving yarn cache
10:43:43 PM: Started saving pip cache
10:43:43 PM: Finished saving pip cache
10:43:43 PM: Started saving emacs cask dependencies
10:43:43 PM: Finished saving emacs cask dependencies
10:43:43 PM: Started saving maven dependencies
10:43:43 PM: Finished saving maven dependencies
10:43:43 PM: Started saving boot dependencies
10:43:43 PM: Finished saving boot dependencies
10:43:43 PM: Started saving go dependencies
10:43:44 PM: Finished saving go dependencies
10:43:46 PM: Error running command: Build script returned non-zero exit code: 1
10:43:46 PM: Failing build: Failed to build site
10:43:46 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
10:43:46 PM: Finished processing build request in 1m28.562451072s
10:43:46 PM: Shutting down logging, 0 messages pending

https://user-images.githubusercontent.com/4457883/57573280-f61abe00-73ea-11e9-8aa9-673f32572202.png https://user-images.githubusercontent.com/4457883/57573280-f61abe00-73ea-11e9-8aa9-673f32572202.png

我期望 Gatsby 网站能够部署到 Netlify 上。这masterBranch 是我的生产站点,但 Netlify 还为分支创建测试版本。


您是否尝试过告诉 Netlify 清除缓存并重建?该错误看起来您的怀疑是正确的,但它没有安装node-sass.

如果您转到 Netlify 仪表板 > 部署,应该有一个“触发部署”下拉菜单,为您提供此选项。

如果这不起作用,请尝试删除yarn.lock并再次安装依赖项以使 Netlify 提取所有内容的新副本。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Gatsby 在 Netlify 部署上构建失败 的相关文章

随机推荐

  • 将 swift 中的嵌套数组转换为一维数组

    我有一个像 我想转换成 E g Hi into Hi 我怎样才能在斯威夫特做到这一点 joined https developer apple com reference swift collection 2432330 joined返回串
  • 阿瓦杰·伊比恩. ManyToMany 延迟 BeanSet

    我正在编写小型应用程序 使用 Play Framework 2 0 它使用 Ebean 作为 ORM 所以我需要 User 类和 UserGroup 类之间的多对多关系 这是一些代码 Entity public class User ext
  • 如何在免安装应用中包含即时动态功能模块?

    我有一个包含这些模块的项目 app bookingfeature 即时启用 map 不是即时的 app包含一些通用代码和资源以及一个启动活动 其中包含一些逻辑 根据应用程序是否即时运行将应用程序路由到正确的目的地 bookingfeatur
  • 插入错误,“2”附近的语法不正确[关闭]

    Closed 这个问题是无法重现或由拼写错误引起 help closed questions 目前不接受答案 我试图将信息添加到表中 但它出现了错误的语法 这是我的插入语句 INSERT INTO Exercise 2 Exercise C
  • Windows Chrome + 黑十字

    我想知道在 Windows 上用 Chrome 运行一个非常简单的网站时是否有人对这个奇怪的问题有任何见解 我基本上将 5 个 div 堆叠在一起 如果窗口调整大小 我也会调整它们的大小 div div div div div div di
  • 在 Mongodb 上使用文本索引时出错

    我正在尝试在 Mongodb 上使用文本索引 我已经在一个集合上使用了文本索引 db ensureIndex field1 text 它有效 但我重试了另一个集合 并收到以下消息 db movies ensureIndex genres t
  • 为什么javac要创建一个额外的类? [复制]

    这个问题在这里已经有答案了 我编译了以下代码 为简洁起见 省略了方法和变量 Outer java public class Outer private class Inner void someMethod Inner inObj this
  • Node.js中的Ajax文件上传

    想要使用 ajax 上传文件 使用此上传器http valums com ajax upload http valums com ajax upload 并在 node js 中编写此代码 该代码可以在没有 ajax 的情况下处理正常文件上
  • 将日期代码添加到 matplotlib/python 图表

    我有一个听起来很简单的问题 但它让我发疯了好几天 我有一个历史时间序列 分为两个列表 第一个列表包含价格 假设 P 1 1 5 1 3 而第二个列表包含相关日期 假设 D 01 01 2010 02 01 2010 我想做的是绘制其中一些日
  • 如何通过索引获取字符串中的字符?

    我知道我可以使用以下命令返回字符串的特定字符的索引indexof 函数 但如何返回特定索引处的字符 string s hello char c s 1 now c e 也可以看看Substring 返回多个字符
  • Chrome:用于测试目的的假麦克风输入

    为了使用量角器进行测试 我需要在没有麦克风的计算机上模拟麦克风的音频输入 通过 use fake device for media stream 标志 Chrome 可以模拟假麦克风 然而 假麦克风没有输入 所以我的测试失败了 是否可以模拟
  • 从 MediaWiki 操作 URL 中删除 index.php

    好的 所以它相当有据可查 https stackoverflow com questions 6667847 mediawiki removing index php from url如何隐藏 url 中的 index php title
  • mysql 如果表存在则插入

    在我的项目中 我有两个在首次设置期间与 MySQL 交互的代码路径 第一步是数据库结构创建 在这里 用户可以选择他们想要的功能 并且根据用户的选择 某些表可能最终不会在数据库中创建 在第二部分中 我需要预加载以下表格did使用一些基本数据创
  • 即使用户重新安装后也限制 iOS 应用程序

    我创建了一个应用程序 在第一次启动时为用户提供 3 个硬币 一旦用户用完 3 个硬币 他应该通过应用内购买购买无限的硬币 问题是 如果用户不想购买无限的硬币 他可以删除该应用程序 重新安装该应用程序 然后他将再次拥有 3 个硬币 他可以永远
  • Unity - 重构的摇摇欲坠的墙脚本停止工作?

    我有一个对象 它立即被数千个小立方体取代 然后在初始化后开始一个接一个地移动 我有有效的代码 但是当我尝试重构它以清理它时 它停止工作 立方体不动 当我尝试将变量初始化和运动初始化分开时 就会发生这种情况 这是我原来的代码段 它可以工作 p
  • 查找给定数字之后的质数

    如何找到大于给定数字的最小素数 例如 给定 4 我需要 5 给定 7 个 我需要 11 个 我想知道一些关于最佳算法的想法 我想到的一种方法是通过埃拉托色尼筛生成素数 然后找到给定数后面的素数 Source 维基百科 伯特兰公设 http
  • 使用 run-as 在 ADB shell 中复制文件

    有没有办法编写一个脚本 使用 run as 从 ADB shell 复制文件 我知道在 adb shell 中复制的唯一方法是使用cat source gt dest 编辑 现代 Android 版本有cp命令 这使得这个问题变得不必要 但
  • 未找到 ObjectSet 库?

    using System using System Collections Generic using System Linq using System Text using System Data using ModelLayer Poc
  • Javamail中的FolderClosed异常

    我正在尝试在 android 中创建一个简单的邮件客户端 并且我在我的应用程序中编译并运行了 javamail 的 android 版本 但是 每当我尝试连接和接收邮件时 我都会收到如下所示的 文件夹已关闭 异常 10 23 12 12 1
  • Gatsby 在 Netlify 部署上构建失败

    我的网站是使用 Gatsby 构建的 并持续部署到 Netlify 我已经两个月没有碰过我的盖茨比网站了 因此 当我运行更新并添加新内容并部署时 我在 Netlify 构建上遇到了重大错误 尝试了很多事情并花了太多时间 最初我只使用 npm