Gridsome stuck on building

Hi there.
I have a gridsome localhost running and building perfectly.

When pushing my repo to netlify it gets stuck at:
2:39:25 PM: at module.exports (/opt/build/repo/node_modules/gridsome/lib/build.js:31:9)

Not sure how to start at this, as I do not get any errors. Just a “building yellow dot”

Thank you for any suggestion

Hiya, sorry you are having trouble with your build.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile: Additionally, this Support Guide houses all of our resources for debugging build and deploy issues.

We also recommend trying to search the forums with the build error you encountered - it’s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!

Hello,

I got a bit further now, now netlify states it failed.

This is my package.json

{
	"name": "XH",
	"private": true,
	"scripts": {
		"develop": "gridsome develop",
		"explore": "gridsome explore",
		"build": "gridsome build"
	},
	"dependencies": {
		"@gridsome/source-filesystem": "^0.6.2",
		"@gridsome/transformer-json": "^0.2.1",
		"@gridsome/transformer-remark": "^0.6.4",
		"gridsome": "^0.7.0",
		"gridsome-plugin-gtag": "^0.1.10",
		"gridsome-plugin-uikit": "^1.0.0",
		"intersection-observer": "^0.12.0",
		"node-sass": "^8.0.0",
		"nprogress": "^0.2.0",
		"style-resources-loader": "^1.5.0",
		"vue-svg-loader": "^0.16.0"
	},
	"devDependencies": {
		"sass-loader": "^10.4.1"
	}
}

Please see the netlify log here:

9:47:39 PM: build-image version: 5ad27658ebdf9c1e4379d77be303c2a3e3daa7bf (focal)
9:47:39 PM: buildbot version: 5ad27658ebdf9c1e4379d77be303c2a3e3daa7bf
9:47:39 PM: Fetching cached dependencies
9:47:39 PM: Failed to fetch cache, continuing with build
9:47:39 PM: Starting to prepare the repo for build
9:47:39 PM: No cached dependencies found. Cloning fresh repo
9:47:39 PM: git clone --filter=blob:none https://github.com/nitras/ABCFlexi
9:47:40 PM: Preparing Git Reference refs/heads/Updates
9:47:41 PM: Parsing package.json dependencies
9:47:42 PM: Starting build script
9:47:42 PM: Installing dependencies
9:47:42 PM: Python version set to 2.7
9:47:42 PM: Downloading and installing node v12.18.0...
9:47:43 PM: Downloading https://nodejs.org/dist/v12.18.0/node-v12.18.0-linux-x64.tar.xz...
9:47:43 PM: Computing checksum with sha256sum
9:47:43 PM: Checksums matched!
9:47:45 PM: Now using node v12.18.0 (npm v6.14.4)
9:47:45 PM: Started restoring cached build plugins
9:47:45 PM: Finished restoring cached build plugins
9:47:46 PM: Attempting Ruby version 2.7.1, read from environment
9:47:46 PM: Required ruby-2.7.1 is not installed - installing.
9:47:46 PM: Searching for binary rubies, this might take some time.
9:47:46 PM: Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/20.04/x86_64/ruby-2.7.1.tar.bz2
9:47:46 PM: Checking requirements for ubuntu.
9:47:47 PM: Requirements installation successful.
9:47:47 PM: ruby-2.7.1 - #configure
9:47:47 PM: ruby-2.7.1 - #download
9:47:47 PM: ruby-2.7.1 - #validate archive
9:47:50 PM: ruby-2.7.1 - #extract
9:47:52 PM: ruby-2.7.1 - #validate binary
9:47:52 PM: ruby-2.7.1 - #setup
9:47:53 PM: ruby-2.7.1 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.7.1@global
9:47:53 PM: ruby-2.7.1 - #importing gemset /opt/buildhome/.rvm/gemsets/global.gems........................................
9:47:53 PM: ruby-2.7.1 - #generating global wrappers........
9:47:53 PM: ruby-2.7.1 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.7.1
9:47:53 PM: ruby-2.7.1 - #importing gemsetfile /opt/buildhome/.rvm/gemsets/default.gems evaluated to empty gem list
9:47:54 PM: ruby-2.7.1 - #generating default wrappers........
9:47:54 PM: Using /opt/buildhome/.rvm/gems/ruby-2.7.1
9:47:54 PM: Using Ruby version 2.7.1
9:47:54 PM: Using PHP version 8.0
9:47:54 PM: Started restoring cached corepack dependencies
9:47:54 PM: Finished restoring cached corepack dependencies
9:47:54 PM: No npm workspaces detected
9:47:54 PM: Started restoring cached node modules
9:47:54 PM: Finished restoring cached node modules
9:47:54 PM: Installing npm packages using npm version 6.14.4
9:48:09 PM: npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
9:48:09 PM: > sharp@0.25.4 install /opt/build/repo/node_modules/sharp
9:48:09 PM: > (node install/libvips && node install/dll-copy && prebuild-install --runtime=napi) || (node-gyp rebuild && node install/dll-copy)
9:48:12 PM: info sharp Detected globally-installed libvips v8.9.1
9:48:12 PM: info sharp Building from source via node-gyp
9:48:16 PM: make: Entering directory '/opt/build/repo/node_modules/sharp/build'
9:48:16 PM:   CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
9:48:16 PM:   AR(target) Release/obj.target/../node-addon-api/nothing.a
9:48:16 PM:   COPY Release/nothing.a
9:48:16 PM:   TOUCH Release/obj.target/libvips-cpp.stamp
9:48:16 PM:   CXX(target) Release/obj.target/sharp/src/common.o
9:48:18 PM:   CXX(target) Release/obj.target/sharp/src/metadata.o
9:48:19 PM:   CXX(target) Release/obj.target/sharp/src/stats.o
9:48:20 PM:   CXX(target) Release/obj.target/sharp/src/operations.o
9:48:22 PM:   CXX(target) Release/obj.target/sharp/src/pipeline.o
9:48:25 PM:   CXX(target) Release/obj.target/sharp/src/utilities.o
9:48:26 PM:   CXX(target) Release/obj.target/sharp/src/sharp.o
9:48:27 PM:   SOLINK_MODULE(target) Release/obj.target/sharp.node
9:48:27 PM:   COPY Release/sharp.node
9:48:27 PM: make: Leaving directory '/opt/build/repo/node_modules/sharp/build'
9:48:27 PM: > node-sass@8.0.0 install /opt/build/repo/node_modules/node-sass
9:48:27 PM: > node scripts/install.js
9:48:27 PM: Downloading binary from https://github.com/sass/node-sass/releases/download/v8.0.0/linux-x64-72_binding.node
9:48:28 PM: Download complete
9:48:28 PM: Binary saved to /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
9:48:28 PM: Caching binary to /opt/buildhome/.npm/node-sass/8.0.0/linux-x64-72_binding.node
9:48:28 PM: > core-js@3.29.0 postinstall /opt/build/repo/node_modules/core-js
9:48:28 PM: > node -e "try{require('./postinstall')}catch(e){}"
9:48:28 PM: > cwebp-bin@5.1.0 postinstall /opt/build/repo/node_modules/cwebp-bin
9:48:28 PM: > node lib/install.js
9:48:28 PM:   ✔ cwebp pre-build test passed successfully
9:48:28 PM: > mozjpeg@6.0.1 postinstall /opt/build/repo/node_modules/mozjpeg
9:48:28 PM: > node lib/install.js
9:48:29 PM:   ✔ mozjpeg pre-build test passed successfully
9:48:29 PM: > pngquant-bin@5.0.2 postinstall /opt/build/repo/node_modules/pngquant-bin
9:48:29 PM: > node lib/install.js
9:48:29 PM:   ✔ pngquant pre-build test passed successfully
9:48:29 PM: > node-sass@8.0.0 postinstall /opt/build/repo/node_modules/node-sass
9:48:29 PM: > node scripts/build.js
9:48:29 PM: Binary found at /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
9:48:29 PM: Testing binary
9:48:29 PM: Binary is fine
9:48:30 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents):
9:48:30 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:48:30 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/gridsome/node_modules/fsevents):
9:48:30 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
9:48:30 PM: added 1701 packages from 846 contributors and audited 1705 packages in 35.299s
9:48:31 PM: 165 packages are looking for funding
9:48:31 PM:   run `npm fund` for details
9:48:31 PM: found 21 vulnerabilities (1 low, 6 moderate, 12 high, 2 critical)
9:48:31 PM:   run `npm audit fix` to fix them, or `npm audit` for details
9:48:31 PM: npm packages installed
9:48:31 PM: Started restoring cached go cache
9:48:31 PM: Finished restoring cached go cache
9:48:31 PM: Installing Go version 1.14.4 (requested 1.14.4)
9:48:35 PM: go version go1.14.4 linux/amd64
9:48:36 PM: Detected 1 framework(s)
9:48:36 PM: "gridsome" at version "0.7.23"
9:48:36 PM: Section completed: initializing
9:48:37 PM: ​
9:48:37 PM:   Netlify Build                                                 
9:48:37 PM: ────────────────────────────────────────────────────────────────
9:48:37 PM: ​
9:48:37 PM: ❯ Version
9:48:37 PM:   @netlify/build 29.5.8
9:48:37 PM: ​
9:48:37 PM: ❯ Flags
9:48:37 PM:   baseRelDir: true
9:48:37 PM:   buildId: 64010b69c5184a0008f02671
9:48:37 PM:   deployId: 64010b69c5184a0008f02673
9:48:37 PM: ​
9:48:37 PM: ❯ Current directory
9:48:37 PM:   /opt/build/repo
9:48:37 PM: ​
9:48:37 PM: ❯ Config file
9:48:37 PM:   No config file was defined: using default values.
9:48:37 PM: ​
9:48:37 PM: ❯ Context
9:48:37 PM:   branch-deploy
9:48:37 PM: ​
9:48:37 PM:   1. Build command from Netlify app                             
9:48:37 PM: ────────────────────────────────────────────────────────────────
9:48:37 PM: ​
9:48:37 PM: $ gridsome build
9:48:38 PM: Gridsome v0.7.23
9:48:38 PM: Initializing plugins...
9:48:38 PM: Load sources - 0.01s
9:48:38 PM: Create GraphQL schema - 0.03s
9:48:38 PM: Create pages and templates - 0.05s
9:48:38 PM: Generate temporary code - 0.03s
9:48:38 PM: Bootstrap finish - 0.48s
9:48:38 PM: Compiling assets...
9:48:38 PM: Error: Cannot find module 'webpack'
9:48:38 PM: Require stack:
9:48:38 PM: - /opt/build/repo/node_modules/vue-server-renderer/server-plugin.js
9:48:38 PM: - /opt/build/repo/node_modules/gridsome/lib/webpack/createServerConfig.js
9:48:38 PM: - /opt/build/repo/node_modules/gridsome/lib/app/Compiler.js
9:48:38 PM: - /opt/build/repo/node_modules/gridsome/lib/app/App.js
9:48:38 PM: - /opt/build/repo/node_modules/gridsome/lib/app/index.js
9:48:38 PM: - /opt/build/repo/node_modules/gridsome/lib/build.js
9:48:38 PM: - /opt/build/repo/node_modules/gridsome/index.js
9:48:38 PM: - /opt/build/repo/node_modules/@gridsome/cli/bin/gridsome.js
9:48:38 PM: - /opt/build/repo/node_modules/gridsome/bin/gridsome.js
9:48:38 PM:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
9:48:38 PM:     at Function.Module._load (internal/modules/cjs/loader.js:842:27)
9:48:38 PM:     at Module.require (internal/modules/cjs/loader.js:1026:19)
9:48:38 PM:     at require (internal/modules/cjs/helpers.js:72:18)
9:48:38 PM:     at Object.<anonymous> (/opt/build/repo/node_modules/vue-server-renderer/server-plugin.js:41:17)
9:48:38 PM:     at Module._compile (internal/modules/cjs/loader.js:1138:30)
9:48:38 PM:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
9:48:38 PM:     at Module.load (internal/modules/cjs/loader.js:986:32)
9:48:38 PM:     at Function.Module._load (internal/modules/cjs/loader.js:879:14)
9:48:38 PM:     at Module.require (internal/modules/cjs/loader.js:1026:19)
9:48:38 PM:     at require (internal/modules/cjs/helpers.js:72:18)
9:48:38 PM:     at module.exports (/opt/build/repo/node_modules/gridsome/lib/webpack/createServerConfig.js:21:10)
9:48:38 PM:     at Compiler.resolveChainableWebpackConfig (/opt/build/repo/node_modules/gridsome/lib/app/Compiler.js:23:25)
9:48:38 PM:     at Compiler.resolveWebpackConfig (/opt/build/repo/node_modules/gridsome/lib/app/Compiler.js:32:47)
9:48:38 PM:     at module.exports (/opt/build/repo/node_modules/gridsome/lib/webpack/compileAssets.js:18:18)
9:48:38 PM:     at async runWebpack (/opt/build/repo/node_modules/gridsome/lib/build.js:64:17)
9:48:38 PM: ​
9:48:38 PM:   "build.command" failed                                        
9:48:38 PM: ────────────────────────────────────────────────────────────────
9:48:38 PM: ​
9:48:38 PM:   Error message
9:48:38 PM:   Command failed with exit code 1: gridsome build (https://ntl.fyi/exit-code-1)
9:48:38 PM: ​
9:48:38 PM:   Error location
9:48:38 PM:   In Build command from Netlify app:
9:48:38 PM:   gridsome build
9:48:38 PM: ​
9:48:38 PM:   Resolved config
9:48:38 PM:   build:
9:48:38 PM:     command: gridsome build
9:48:38 PM:     commandOrigin: ui
9:48:38 PM:     publish: /opt/build/repo/dist
9:48:38 PM:     publishOrigin: ui
9:48:39 PM: Caching artifacts
9:48:39 PM: Started saving node modules
9:48:39 PM: Finished saving node modules
9:48:40 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
9:48:39 PM: Started saving build plugins
9:48:39 PM: Finished saving build plugins
9:48:39 PM: Started saving corepack cache
9:48:39 PM: Finished saving corepack cache
9:48:39 PM: Started saving pip cache
9:48:39 PM: Finished saving pip cache
9:48:39 PM: Started saving emacs cask dependencies
9:48:39 PM: Finished saving emacs cask dependencies
9:48:39 PM: Started saving maven dependencies
9:48:39 PM: Finished saving maven dependencies
9:48:39 PM: Started saving boot dependencies
9:48:39 PM: Finished saving boot dependencies
9:48:39 PM: Started saving rust rustup cache
9:48:39 PM: Finished saving rust rustup cache
9:48:39 PM: Started saving go dependencies
9:48:39 PM: Finished saving go dependencies
9:48:40 PM: Cached Ruby version 2.7.1
9:48:40 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:48:40 PM: Failing build: Failed to build site
9:48:40 PM: Finished processing build request in 1m1.453s

@nitras Does your build work locally?

The error shown in the build log is:

9:48:38 PM: Error: Cannot find module 'webpack'

Hi Nathan,

Thanks for pointing that out.
I am able to run gridsome develop (site loads up locally and is working)
But I am indeed unable to build locally. Which trows a different error:

Apparently, there is no solution.

Oddly enough. I removed the following packages (that I experimented with but not actually am using) — and was able to build and push to the live site.

"intersection-observer": "^0.12.0",
"nprogress": "^0.2.0",
"style-resources-loader": "^1.5.0",
"vue-svg-loader": "^0.16.0"

Because that worked I decided to add them again via npm install
where I was that “intersection-observer”: “^0.12.2”,
has a newer version.

I was able to build… and add all other packages again…
So I assume to make a long story short, the error was a conflict somewhere in the intersection observer.

Still not sure, very new to all of this, but just putting it here. You never know how it can help others.

best regards

Thanks for sharing this additional information @nitras !