sanity-io / sanity-template-gatsby-portfolio

A Gatsby portfolio site powered by Sanity for https://www.sanity.io/create
https://www.sanity.io/create/?template=sanity-io%2Fsanity-template-gatsby-portfolio
69 stars 18 forks source link

Gatsby deploy failure on Netlify #52

Closed KOYAMANI closed 4 years ago

KOYAMANI commented 4 years ago

Hello!

I tried to deploy a new project using the Gastby new-blog-starter. The studio netlify site builds fine but the Gatsby site on Netlify fails in its first deploy job with the error message:

TypeError: {(intermediate value)(intermediate value)} is not a function

I am going to share deploy log as followings

9:07:57 PM: Build ready to start
9:07:58 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
9:07:58 PM: build-image tag: v3.4.1
9:07:58 PM: buildbot version: 648208d76731cd5bca75c1e9bc99d2032a1f1473
9:07:58 PM: Building without cache
9:07:58 PM: Starting to prepare the repo for build
9:07:59 PM: No cached dependencies found. Cloning fresh repo
9:07:59 PM: git clone https://github.com/KOYAMANI/gatsby-netlify
9:07:59 PM: Preparing Git Reference refs/heads/master
9:08:01 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
9:08:01 PM: Starting build script
9:08:01 PM: Installing dependencies
9:08:01 PM: Python version set to 2.7
9:08:02 PM: Downloading and installing node v14.12.0...
9:08:02 PM: Downloading https://nodejs.org/dist/v14.12.0/node-v14.12.0-linux-x64.tar.xz...
9:08:03 PM: Computing checksum with sha256sum
9:08:03 PM: Checksums matched!
9:08:06 PM: Now using node v14.12.0 (npm v6.14.8)
9:08:06 PM: Started restoring cached build plugins
9:08:06 PM: Finished restoring cached build plugins
9:08:07 PM: Attempting ruby version 2.7.1, read from environment
9:08:08 PM: Using ruby version 2.7.1
9:08:08 PM: Using PHP version 5.6
9:08:09 PM: 5.2 is already installed.
9:08:09 PM: Using Swift version 5.2
9:08:09 PM: Started restoring cached node modules
9:08:09 PM: Finished restoring cached node modules
9:08:09 PM: Installing NPM modules using NPM version 6.14.8
9:09:14 PM: > sharp@0.25.4 install /opt/build/repo/node_modules/sharp
9:09:14 PM: > (node install/libvips && node install/dll-copy && prebuild-install --runtime=napi) || (node-gyp rebuild && node install/dll-copy)
9:09:14 PM: info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.9.1/libvips-8.9.1-linux-x64.tar.gz
9:09:16 PM: > core-js@2.6.11 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
9:09:16 PM: > node -e "try{require('./postinstall')}catch(e){}"
9:09:16 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/core-js
9:09:16 PM: > node -e "try{require('./postinstall')}catch(e){}"
9:09:17 PM: > core-js-pure@3.6.5 postinstall /opt/build/repo/node_modules/core-js-pure
9:09:17 PM: > node -e "try{require('./postinstall')}catch(e){}"
9:09:18 PM: > gatsby-telemetry@1.3.35 postinstall /opt/build/repo/node_modules/gatsby-telemetry
9:09:18 PM: > node src/postinstall.js || true
9:09:18 PM: > mozjpeg@7.0.0 postinstall /opt/build/repo/node_modules/mozjpeg
9:09:18 PM: > node lib/install.js
9:09:18 PM:   ✔ mozjpeg pre-build test passed successfully
9:09:18 PM: > pngquant-bin@6.0.0 postinstall /opt/build/repo/node_modules/pngquant-bin
9:09:18 PM: > node lib/install.js
9:09:19 PM:   ✔ pngquant pre-build test passed successfully
9:09:19 PM: > gatsby-cli@2.12.99 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli
9:09:19 PM: > node scripts/postinstall.js
9:09:19 PM: > gatsby@2.24.63 postinstall /opt/build/repo/node_modules/gatsby
9:09:19 PM: > node scripts/postinstall.js
9:09:23 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents):
9:09:23 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
9:09:23 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/chokidar/node_modules/fsevents):
9:09:23 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
9:09:23 PM: added 2737 packages from 1500 contributors and audited 2745 packages in 73.299s
9:09:26 PM: 202 packages are looking for funding
9:09:26 PM:   run `npm fund` for details
9:09:26 PM: found 3 low severity vulnerabilities
9:09:26 PM:   run `npm audit fix` to fix them, or `npm audit` for details
9:09:26 PM: NPM modules installed
9:09:26 PM: Started restoring cached go cache
9:09:26 PM: Finished restoring cached go cache
9:09:26 PM: go version go1.14.4 linux/amd64
9:09:27 PM: go version go1.14.4 linux/amd64
9:09:27 PM: Installing missing commands
9:09:27 PM: Verify run directory
9:09:28 PM: ​
9:09:28 PM: ┌─────────────────────────────┐
9:09:28 PM: │        Netlify Build        │
9:09:28 PM: └─────────────────────────────┘
9:09:28 PM: ​
9:09:28 PM: ❯ Version
9:09:28 PM:   @netlify/build 4.0.4
9:09:28 PM: ​
9:09:28 PM: ❯ Flags
9:09:28 PM:   deployId: 5f6f918de955484b760d27b2
9:09:28 PM:   mode: buildbot
9:09:28 PM: ​
9:09:28 PM: ❯ Current directory
9:09:28 PM:   /opt/build/repo
9:09:28 PM: ​
9:09:28 PM: ❯ Config file
9:09:28 PM:   No config file was defined: using default values.
9:09:28 PM: ​
9:09:28 PM: ❯ Context
9:09:28 PM:   production
9:09:28 PM: ​
9:09:28 PM: ┌───────────────────────────────────┐
9:09:28 PM: │ 1. Build command from Netlify app │
9:09:28 PM: └───────────────────────────────────┘
9:09:28 PM: ​
9:09:28 PM: $ gatsby build
9:09:31 PM: error We encountered an error while trying to load your site's gatsby-config. Please fix the error and try again.
9:09:31 PM: 
9:09:31 PM:   TypeError: {(intermediate value)(intermediate value)} is not a function
9:09:31 PM:   
9:09:31 PM:   - gatsby-config.js:80 Object.<anonymous>
9:09:31 PM:     /opt/build/repo/gatsby-config.js:80:1
9:09:31 PM:   
9:09:31 PM:   - v8-compile-cache.js:178 Module._compile
9:09:31 PM:     [repo]/[v8-compile-cache]/v8-compile-cache.js:178:30
9:09:31 PM:   
9:09:31 PM:   - loader.js:1097 Object.Module._extensions..js
9:09:31 PM:     internal/modules/cjs/loader.js:1097:10
9:09:31 PM:   
9:09:31 PM:   - loader.js:941 Module.load
9:09:31 PM:     internal/modules/cjs/loader.js:941:32
9:09:31 PM:   
9:09:31 PM:   - loader.js:782 Function.Module._load
9:09:31 PM:     internal/modules/cjs/loader.js:782:14
9:09:31 PM:   
9:09:31 PM:   - loader.js:965 Module.require
9:09:31 PM:     internal/modules/cjs/loader.js:965:19
9:09:31 PM:   
9:09:31 PM:   - v8-compile-cache.js:159 require
9:09:31 PM:     [repo]/[v8-compile-cache]/v8-compile-cache.js:159:20
9:09:31 PM:   
9:09:31 PM:   - get-config-file.ts:30 getConfigFile
9:09:31 PM:     [repo]/[gatsby]/src/bootstrap/get-config-file.ts:30:20
9:09:31 PM:   
9:09:31 PM:   - initialize.ts:113 initialize
9:09:31 PM:     [repo]/[gatsby]/src/services/initialize.ts:113:50
9:09:31 PM:   
9:09:31 PM:   - index.ts:40 bootstrap
9:09:31 PM:     [repo]/[gatsby]/src/bootstrap/index.ts:40:15
9:09:31 PM:   
9:09:31 PM:   - build.ts:91 build
9:09:31 PM:     [repo]/[gatsby]/src/commands/build.ts:91:47
9:09:31 PM:   
9:09:31 PM: 
9:09:31 PM: not finished open and validate gatsby-configs - 0.078s
9:09:31 PM: ​
9:09:31 PM: ┌─────────────────────────────┐
9:09:31 PM: │   "build.command" failed    │
9:09:31 PM: └─────────────────────────────┘
9:09:31 PM: ​
9:09:31 PM:   Error message
9:09:31 PM:   Command failed with exit code 1: gatsby build
9:09:31 PM: ​
9:09:31 PM:   Error location
9:09:31 PM:   In Build command from Netlify app:
9:09:31 PM:   gatsby build
9:09:31 PM: ​
9:09:31 PM:   Resolved config
9:09:31 PM:   build:
9:09:31 PM:     command: gatsby build
9:09:31 PM:     commandOrigin: ui
9:09:31 PM:     environment:
9:09:31 PM:       - NODE_VERSION
9:09:31 PM:     publish: /opt/build/repo/public
9:09:31 PM: Caching artifacts
9:09:31 PM: Started saving node modules
9:09:31 PM: Finished saving node modules
9:09:31 PM: Started saving build plugins
9:09:31 PM: Finished saving build plugins
9:09:31 PM: Started saving pip cache
9:09:31 PM: Finished saving pip cache
9:09:31 PM: Started saving emacs cask dependencies
9:09:31 PM: Finished saving emacs cask dependencies
9:09:31 PM: Started saving maven dependencies
9:09:31 PM: Finished saving maven dependencies
9:09:31 PM: Started saving boot dependencies
9:09:31 PM: Finished saving boot dependencies
9:09:31 PM: Started saving go dependencies
9:09:31 PM: Finished saving go dependencies
9:09:35 PM: Error running command: Build script returned non-zero exit code: 2
9:09:35 PM: Failing build: Failed to build site
9:09:35 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
9:09:35 PM: Finished processing build request in 1m36.704517794s

According to below message, I looked back to gatby-config.js but I believe there is no function inside.

error We encountered an error while trying to load your site's gatsby-config. Please fix the error and try again.

The code of my gatsby-config.js is as following

module.exports = {
  siteMetadata: {
    title: `Coding Blog`,
    author: {
      name: `Yutaro Koyama`,
      summary: `a blog for learning code.`,
    },
    description: `A starter blog demonstrating what Gatsby can do.`,
    siteUrl: `https://gatsby-starter-blog-demo.netlify.app/`,
    social: {
      twitter: `@koyamani1114`,
    },
  },
  plugins: [
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `${__dirname}/content/blog`,
        name: `blog`,
      },
    },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `${__dirname}/content/assets`,
        name: `assets`,
      },
    },
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          {
            resolve: `gatsby-remark-images`,
            options: {
              maxWidth: 630,
            },
          },
          {
            resolve: `gatsby-remark-responsive-iframe`,
            options: {
              wrapperStyle: `margin-bottom: 1.0725rem`,
            },
          },
          `gatsby-remark-prismjs`,
          `gatsby-remark-copy-linked-files`,
          `gatsby-remark-smartypants`,
        ],
      },
    },
    `gatsby-transformer-sharp`,
    `gatsby-plugin-sharp`,
    `gatsby-image`,
    {
      resolve: `gatsby-plugin-google-analytics`,
      options: {
        //trackingId: `ADD YOUR TRACKING ID HERE`,
      },
    },
    `gatsby-plugin-feed`,
    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        name: `Gatsby Starter Blog`,
        short_name: `GatsbyJS`,
        start_url: `/`,
        background_color: `#ffffff`,
        theme_color: `#663399`,
        display: `minimal-ui`,
        icon: `content/assets/gatsby-icon.png`,
      },
    },
    `gatsby-plugin-react-helmet`,
    `gatsby-plugin-netlify-cms`
    // this (optional) plugin enables Progressive Web App + Offline functionality
    // To learn more, visit: https://gatsby.dev/offline
    // `gatsby-plugin-offline`,
  ],
}