質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
JavaScript

JavaScriptは、プログラミング言語のひとつです。ネットスケープコミュニケーションズで開発されました。 開発当初はLiveScriptと呼ばれていましたが、業務提携していたサン・マイクロシステムズが開発したJavaが脚光を浴びていたことから、JavaScriptと改名されました。 動きのあるWebページを作ることを目的に開発されたもので、主要なWebブラウザのほとんどに搭載されています。

Q&A

1回答

424閲覧

Gatsby+Contentful+Netlifyでのサイト構築のビルドが失敗する

xu0124

総合スコア31

JavaScript

JavaScriptは、プログラミング言語のひとつです。ネットスケープコミュニケーションズで開発されました。 開発当初はLiveScriptと呼ばれていましたが、業務提携していたサン・マイクロシステムズが開発したJavaが脚光を浴びていたことから、JavaScriptと改名されました。 動きのあるWebページを作ることを目的に開発されたもので、主要なWebブラウザのほとんどに搭載されています。

0グッド

0クリップ

投稿2018/11/25 14:23

https://github.com/ryanwiemer/gatsby-starter-gcn
をクローンして自分のGitHubのリポジトリに格納。

Netlifyにて、ドキュメントどおりにデプロイしたところエラーでビルドがうまくいきません。

※Contentfulを登録、各種設定して、APIキー(ACCESS_TOKENとSPACE_ID)を取得して、Netlifyへ記述済みです。

<エラーコード>
TypeError: Cannot read property 'allContentfulPost' of undefined

どうしたらよいのかさっぱりわからないので、質問させてください。
よろしくお願いいたします。

<エラーログ>

10:59:39 PM: Build ready to start 10:59:40 PM: build-image version: 12783d4d177a66bec5a23ad1097ea7bd02931128 10:59:40 PM: buildbot version: 5a64b5cb0ce1ed3ba485935522483a4d39e15107 10:59:40 PM: Fetching cached dependencies 10:59:41 PM: Failed to fetch cache, continuing with build 10:59:41 PM: Starting to prepare the repo for build 10:59:41 PM: No cached dependencies found. Cloning fresh repo 10:59:41 PM: git clone https://github.com/min0124/live-method 10:59:42 PM: Preparing Git Reference refs/heads/master 10:59:42 PM: Starting build script 10:59:42 PM: Installing dependencies 10:59:43 PM: Downloading and installing node v8.13.0... 10:59:43 PM: Downloading https://nodejs.org/dist/v8.13.0/node-v8.13.0-linux-x64.tar.xz... 10:59:44 PM: # 10:59:44 PM: 1.8% 10:59:44 PM: ##################################### 10:59:44 PM: 52.1% 10:59:44 PM: ######################################################## 10:59:44 PM: ################ 100.0% 10:59:44 PM: Computing checksum with sha256sum 10:59:44 PM: Checksums matched! 10:59:46 PM: Now using node v8.13.0 (npm v6.4.1) 10:59:46 PM: Attempting ruby version 2.3.6, read from environment 10:59:47 PM: Using ruby version 2.3.6 10:59:47 PM: Using PHP version 5.6 10:59:47 PM: Started restoring cached node modules 10:59:47 PM: Finished restoring cached node modules 10:59:48 PM: Installing NPM modules using NPM version 6.4.1 11:00:36 PM: > sharp@0.20.8 install /opt/build/repo/node_modules/sharp 11:00:36 PM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy) 11:00:36 PM: info 11:00:36 PM: sharp Detected globally-installed libvips v8.6.2 11:00:36 PM: info sharp Building from source via node-gyp 11:00:38 PM: make: Entering directory `/opt/build/repo/node_modules/sharp/build' 11:00:38 PM: TOUCH Release/obj.target/libvips-cpp.stamp 11:00:38 PM: CXX(target) Release/obj.target/sharp/src/common.o 11:00:40 PM: CXX(target) Release/obj.target/sharp/src/metadata.o 11:00:41 PM: CXX(target) Release/obj.target/sharp/src/stats.o 11:00:43 PM: CXX(target) Release/obj.target/sharp/src/operations.o 11:00:45 PM: CXX(target) Release/obj.target/sharp/src/pipeline.o 11:00:48 PM: CXX(target) Release/obj.target/sharp/src/sharp.o 11:00:49 PM: CXX(target) Release/obj.target/sharp/src/utilities.o 11:00:51 PM: SOLINK_MODULE(target) Release/obj.target/sharp.node 11:00:51 PM: COPY Release/sharp.node 11:00:51 PM: make: Leaving directory `/opt/build/repo/node_modules/sharp/build' 11:00:52 PM: > cwebp-bin@4.0.0 postinstall /opt/build/repo/node_modules/cwebp-bin 11:00:52 PM: > node lib/install.js 11:00:53 PM: ✔ cwebp pre-build test passed successfully 11:00:53 PM: > mozjpeg@5.0.0 postinstall /opt/build/repo/node_modules/mozjpeg 11:00:53 PM: > node lib/install.js 11:00:53 PM: ⚠ The `/opt/build/repo/node_modules/mozjpeg/vendor/cjpeg` binary doesn't seem to work correctly 11:00:53 PM: ⚠ mozjpeg pre-build test failed 11:00:53 PM: ℹ compiling from source 11:01:32 PM: ✔ mozjpeg built successfully 11:01:32 PM: > pngquant-bin@5.0.0 postinstall /opt/build/repo/node_modules/pngquant-bin 11:01:32 PM: > node lib/install.js 11:01:33 PM: ✔ pngquant pre-build test passed successfully 11:01:33 PM: > styled-components@4.0.2 postinstall /opt/build/repo/node_modules/styled-components 11:01:33 PM: > node ./scripts/postinstall.js || exit 0 11:01:33 PM: Use styled-components at work? Consider supporting our development efforts at https://opencollective.com/styled-components 11:01:40 PM: npm 11:01:40 PM: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents): 11:01:40 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) 11:01:40 PM: added 2340 packages from 1249 contributors and audited 30939 packages in 111.962s 11:01:40 PM: found 5 moderate severity vulnerabilities 11:01:40 PM: run `npm audit fix` to fix them, or `npm audit` for details 11:01:40 PM: NPM modules installed 11:01:41 PM: Started restoring cached go cache 11:01:41 PM: Finished restoring cached go cache 11:01:41 PM: unset GOOS; 11:01:41 PM: unset GOARCH; 11:01:41 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.10.linux.amd64'; 11:01:41 PM: export PATH="/opt/buildhome/.gimme/versions/go1.10.linux.amd64/bin:${PATH}"; 11:01:41 PM: go version >&2; 11:01:41 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.10.linux.amd64.env'; 11:01:41 PM: go version go1.10 linux/amd64 11:01:41 PM: Installing missing commands 11:01:41 PM: Verify run directory 11:01:41 PM: Executing user command: gatsby build 11:01:43 PM: success open and validate gatsby-configs — 0.008 s 11:01:43 PM: success load plugins — 0.304 s 11:01:44 PM: success onPreInit — 0.710 s 11:01:44 PM: success delete html and css files from previous builds — 0.083 s 11:01:44 PM: success initialize cache — 0.009 s 11:01:44 PM: success copy gatsby files — 0.131 s 11:01:44 PM: success onPreBootstrap — 0.011 s 11:01:44 PM: Starting to fetch data from Contentful 11:01:44 PM: Fetching default locale 11:01:44 PM: default locale is : en-US 11:01:49 PM: contentTypes fetched 10 11:01:49 PM: Updated entries 37 11:01:49 PM: Deleted entries 0 11:01:49 PM: Updated assets 0 11:01:49 PM: Deleted assets 0 11:01:49 PM: Fetch Contentful data: 5234.619ms 11:01:50 PM: success source and transform nodes — 5.600 s 11:01:50 PM: success building schema — 0.489 s 11:01:50 PM: error Cannot read property 'allContentfulPost' of undefined 11:01:50 PM: 11:01:50 PM: TypeError: Cannot read property 'allContentfulPost' of undefined 11:01:50 PM: 11:01:50 PM: - gatsby-node.js:23 graphql.then.result 11:01:50 PM: /opt/build/repo/gatsby-node.js:23:33 11:01:50 PM: 11:01:50 PM: - util.js:16 tryCatcher 11:01:50 PM: [repo]/[bluebird]/js/release/util.js:16:23 11:01:50 PM: 11:01:50 PM: - promise.js:512 Promise._settlePromiseFromHandler 11:01:50 PM: [repo]/[bluebird]/js/release/promise.js:512:31 11:01:50 PM: 11:01:50 PM: - promise.js:569 Promise._settlePromise 11:01:50 PM: [repo]/[bluebird]/js/release/promise.js:569:18 11:01:50 PM: 11:01:51 PM: - promise.js:606 Promise._settlePromiseCtx 11:01:51 PM: [repo]/[bluebird]/js/release/promise.js:606:10 11:01:51 PM: 11:01:51 PM: - async.js:142 _drainQueueStep 11:01:51 PM: [repo]/[bluebird]/js/release/async.js:142:12 11:01:51 PM: 11:01:51 PM: - async.js:131 _drainQueue 11:01:51 PM: [repo]/[bluebird]/js/release/async.js:131:9 11:01:51 PM: 11:01:51 PM: - async.js:147 Async._drainQueues 11:01:51 PM: [repo]/[bluebird]/js/release/async.js:147:5 11:01:51 PM: 11:01:51 PM: - async.js:17 Immediate.Async.drainQueues 11:01:51 PM: [repo]/[bluebird]/js/release/async.js:17:14 11:01:51 PM: 11:01:51 PM: 11:01:51 PM: error UNHANDLED REJECTION 11:01:51 PM: 11:01:51 PM: TypeError: Cannot read property 'allContentfulPost' of undefined 11:01:51 PM: 11:01:51 PM: - gatsby-node.js:23 graphql.then.result 11:01:51 PM: /opt/build/repo/gatsby-node.js:23:33 11:01:51 PM: 11:01:51 PM: - util.js:16 tryCatcher 11:01:51 PM: [repo]/[bluebird]/js/release/util.js:16:23 11:01:51 PM: 11:01:51 PM: - promise.js:512 Promise._settlePromiseFromHandler 11:01:51 PM: [repo]/[bluebird]/js/release/promise.js:512:31 11:01:51 PM: 11:01:51 PM: - promise.js:569 Promise._settlePromise 11:01:51 PM: [repo]/[bluebird]/js/release/promise.js:569:18 11:01:51 PM: 11:01:51 PM: - promise.js:606 Promise._settlePromiseCtx 11:01:51 PM: [repo]/[bluebird]/js/release/promise.js:606:10 11:01:51 PM: 11:01:51 PM: - async.js:142 _drainQueueStep 11:01:51 PM: [repo]/[bluebird]/js/release/async.js:142:12 11:01:51 PM: 11:01:51 PM: - async.js:131 _drainQueue 11:01:51 PM: [repo]/[bluebird]/js/release/async.js:131:9 11:01:51 PM: 11:01:51 PM: - async.js:147 Async._drainQueues 11:01:51 PM: [repo]/[bluebird]/js/release/async.js:147:5 11:01:51 PM: 11:01:51 PM: - async.js:17 Immediate.Async.drainQueues 11:01:51 PM: [repo]/[bluebird]/js/release/async.js:17:14 11:01:51 PM: 11:01:51 PM: 11:01:51 PM: Caching artifacts 11:01:51 PM: Started saving node modules 11:01:51 PM: Finished saving node modules 11:01:51 PM: Started saving pip cache 11:01:51 PM: Finished saving pip cache 11:01:51 PM: Started saving emacs cask dependencies 11:01:51 PM: Finished saving emacs cask dependencies 11:01:51 PM: Started saving maven dependencies 11:01:51 PM: Finished saving maven dependencies 11:01:51 PM: Started saving boot dependencies 11:01:51 PM: Finished saving boot dependencies 11:01:51 PM: Started saving go dependencies 11:01:51 PM: Finished saving go dependencies 11:01:51 PM: Cached node version v8.13.0 11:01:51 PM: Error running command: Build script returned non-zero exit code: 1 11:01:51 PM: Failing build: Failed to build site 11:01:51 PM: failed during stage 'building site': Build script returned non-zero exit code: 1 11:01:52 PM: Finished processing build request in 2m11.335637823s

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

パット見contentfulからデータが取得できなくて止まってるエラーのように見えますね。
もう一度contentnful周りを見直してみるのが優先かなと思いました。

投稿2019/01/22 00:42

sakapun

総合スコア888

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問