Home
Support Forums

Fail to build on Netlify but success on local machine

Hello everyone…

First of all thanks in advance…

I’m facing an issue where when I execute gridsome build in my local machine it builds everything but, when I execute gridsome build in Netlify it gives me the following error:


I don’t know what to do more to be honest :frowning:

Thanks one more time

Hi there,

Thanks for reaching out. We will need just a bit more information before we can dig into this further. Can you share your Netlify site name, your full build log, and your repo?

Hello,

Sure, my Netlify name is BitInByte…

The full build log is:

5:00:05 PM: Build ready to start
5:00:08 PM: build-image version: c5b01a919d3e16af69445c5de0cacb49efbb1a23 (focal)
5:00:08 PM: build-image tag: v4.4.0
5:00:08 PM: buildbot version: 0ada244ab84a1759a70d6b2cfc27c9987b5c77ca
5:00:08 PM: Fetching cached dependencies
5:00:08 PM: Failed to fetch cache, continuing with build
5:00:08 PM: Starting to prepare the repo for build
5:00:09 PM: No cached dependencies found. Cloning fresh repo
5:00:09 PM: git clone https://github.com/BitInByte/portfolioV2
5:00:10 PM: Preparing Git Reference refs/heads/main
5:00:10 PM: Parsing package.json dependencies
5:00:11 PM: Starting build script
5:00:11 PM: Installing dependencies
5:00:11 PM: Python version set to 2.7
5:00:11 PM: Downloading and installing node v16.13.0...
5:00:11 PM: Downloading https://nodejs.org/dist/v16.13.0/node-v16.13.0-linux-x64.tar.xz...
5:00:12 PM: Computing checksum with sha256sum
5:00:12 PM: Checksums matched!
5:00:14 PM: Now using node v16.13.0 (npm v8.1.0)
5:00:15 PM: Started restoring cached build plugins
5:00:15 PM: Finished restoring cached build plugins
5:00:15 PM: Attempting ruby version 2.7.2, read from environment
5:00:16 PM: Using ruby version 2.7.2
5:00:16 PM: Using PHP version 8.0
5:00:16 PM: Started restoring cached yarn cache
5:00:16 PM: Finished restoring cached yarn cache
5:00:16 PM: Installing yarn at version 1.22.10
5:00:16 PM: Installing Yarn!
5:00:16 PM: > Downloading tarball...
5:00:16 PM: [1/2]: https://yarnpkg.com/downloads/1.22.10/yarn-v1.22.10.tar.gz --> /tmp/yarn.tar.gz.inH0YpSKrP
5:00:16 PM:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
5:00:16 PM:                                  Dload  Upload   Total   Spent    Left  Speed
5:00:16 PM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
5:00:16 PM: 100    81  100    81    0     0    509      0 --:--:-- --:--:-- --:--:--   506
5:00:16 PM: 100    81  100    81    0     0    509      0 --:--:-- --:--:-- --:--:--   506
5:00:17 PM: 100    95  100    95    0     0    251      0 --:--:-- --:--:-- --:--:--   251
5:00:17 PM: 100   626  100   626    0     0   1329      0 --:--:-- --:--:-- --:--:--  1329
5:00:17 PM: 100 1215k  100 1215k    0     0  1822k      0 --:--:-- --:--:-- --:--:-- 1822k
5:00:17 PM: [2/2]: https://yarnpkg.com/downloads/1.22.10/yarn-v1.22.10.tar.gz.asc --> /tmp/yarn.tar.gz.inH0YpSKrP.asc
5:00:17 PM:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
5:00:17 PM:                                  Dload  Upload   Total   Spent    Left  Speed
5:00:17 PM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
5:00:17 PM: 100    85  100    85    0     0   1268      0 --:--:-- --:--:-- --:--:--  1268
5:00:17 PM: 100    99  100    99    0     0   1031      0 --:--:-- --:--:-- --:--:--  1031
5:00:17 PM: 100   630  100   630    0     0   3214      0 --:--:-- --:--:-- --:--:--  3214
5:00:17 PM: 100   832  100   832    0     0   3301      0 --:--:-- --:--:-- --:--:--  3301
5:00:17 PM: > Verifying integrity...
5:00:17 PM: gpg: Signature made Fri 02 Oct 2020 11:17:27 AM UTC
5:00:17 PM: gpg:                using RSA key 6D98490C6F1ACDDD448E45954F77679369475BAA
5:00:17 PM: gpg: Good signature from "Yarn Packaging <yarn@dan.cx>" [unknown]
5:00:17 PM: gpg: WARNING: This key is not certified with a trusted signature!
5:00:17 PM: gpg:          There is no indication that the signature belongs to the owner.
5:00:17 PM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907  BBB7 1646 B01B 86E5 0310
5:00:17 PM:      Subkey fingerprint: 6D98 490C 6F1A CDDD 448E  4595 4F77 6793 6947 5BAA
5:00:17 PM: > GPG signature looks good
5:00:17 PM: > Extracting to ~/.yarn...
5:00:17 PM: > Adding to $PATH...
5:00:18 PM: > Successfully installed Yarn 1.22.10! Please open another terminal where the `yarn` command will now be available.
5:00:18 PM: No yarn workspaces detected
5:00:18 PM: Started restoring cached node modules
5:00:18 PM: Finished restoring cached node modules
5:00:18 PM: Installing NPM modules using Yarn version 1.22.10
5:00:19 PM: yarn install v1.22.10
5:00:19 PM: [1/4] Resolving packages...
5:00:20 PM: [2/4] Fetching packages...
5:00:26 PM: warning mini-css-extract-plugin@0.5.0: Invalid bin field for "mini-css-extract-plugin".
5:00:26 PM: warning url-loader@1.1.2: Invalid bin field for "url-loader".
5:00:39 PM: info fsevents@1.2.13: The platform "linux" is incompatible with this module.
5:00:39 PM: info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
5:00:39 PM: info fsevents@2.3.2: The platform "linux" is incompatible with this module.
5:00:39 PM: info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
5:00:39 PM: [3/4] Linking dependencies...
5:00:39 PM: warning " > @fortawesome/vue-fontawesome@2.0.6" has unmet peer dependency "vue@~2".
5:00:39 PM: warning " > sass-loader@10.2.0" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
5:00:39 PM: warning " > style-resources-loader@1.4.1" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0 || ^5.0.0".
5:00:39 PM: warning " > ts-loader@8.3.0" has unmet peer dependency "webpack@*".
5:00:48 PM: [4/4] Building fresh packages...
5:01:15 PM: Done in 55.52s.
5:01:15 PM: NPM modules installed using Yarn
5:01:15 PM: Started restoring cached go cache
5:01:15 PM: Finished restoring cached go cache
5:01:15 PM: go version go1.16.5 linux/amd64
5:01:15 PM: go version go1.16.5 linux/amd64
5:01:15 PM: Installing missing commands
5:01:15 PM: Verify run directory
5:01:16 PM: ​
5:01:16 PM: ────────────────────────────────────────────────────────────────
5:01:16 PM:   Netlify Build                                                 
5:01:16 PM: ────────────────────────────────────────────────────────────────
5:01:16 PM: ​
5:01:16 PM: ❯ Version
5:01:16 PM:   @netlify/build 18.19.2
5:01:16 PM: ​
5:01:16 PM: ❯ Flags
5:01:16 PM:   baseRelDir: true
5:01:16 PM:   buildId: 617c1a85a8fd57000766a7da
5:01:16 PM:   deployId: 617c1a85a8fd57000766a7dc
5:01:16 PM: ​
5:01:16 PM: ❯ Current directory
5:01:16 PM:   /opt/build/repo
5:01:16 PM: ​
5:01:16 PM: ❯ Config file
5:01:16 PM:   No config file was defined: using default values.
5:01:16 PM: ​
5:01:16 PM: ❯ Context
5:01:16 PM:   production
5:01:16 PM: ​
5:01:16 PM: ────────────────────────────────────────────────────────────────
5:01:16 PM:   1. Build command from Netlify app                             
5:01:16 PM: ────────────────────────────────────────────────────────────────
5:01:16 PM: ​
5:01:16 PM: $ gridsome build
5:01:17 PM: Gridsome v0.7.23
5:01:17 PM: Initializing plugins...
5:01:18 PM: Load sources - 1.08s
5:01:19 PM: Create GraphQL schema - 0.07s
5:01:19 PM: Create pages and templates - 0.04s
5:01:19 PM: Generate temporary code - 0.02s
5:01:24 PM: ImageDownloader - 5.62s
5:01:24 PM: ImageDownloader - 0s
5:01:24 PM: Bootstrap finish - 7.59s
5:01:24 PM: Compiling assets...
5:01:45 PM: Compile assets - 20.77s
5:01:45 PM: An error occurred while executing page-query for src/pages/Projects.vue
5:01:45 PM: 
5:01:45 PM: Error: Field "remoteImage" of type "[Images]" must have a selection of subfields. Did you mean "remoteImage { ... }"?
5:01:45 PM: GraphQL request:22:9
5:01:45 PM: 21 |         id
5:01:45 PM: 22 |         remoteImage
5:01:45 PM:    |         ^
5:01:45 PM: 23 |         title
5:01:45 PM:     at throwError (/opt/build/repo/node_modules/gridsome/lib/app/build/executeQueries.js:22:13)
5:01:45 PM:     at pMap.concurrency (/opt/build/repo/node_modules/gridsome/lib/app/build/executeQueries.js:50:11)
5:01:45 PM:     at /opt/build/repo/node_modules/p-map/index.js:47:21
5:01:45 PM: ​
5:01:45 PM: ────────────────────────────────────────────────────────────────
5:01:45 PM:   "build.command" failed                                        
5:01:45 PM: ────────────────────────────────────────────────────────────────
5:01:45 PM: ​
5:01:45 PM:   Error message
5:01:45 PM:   Command failed with exit code 1: gridsome build
5:01:45 PM: ​
5:01:45 PM:   Error location
5:01:45 PM:   In Build command from Netlify app:
5:01:45 PM:   gridsome build
5:01:45 PM: ​
5:01:45 PM:   Resolved config
5:01:45 PM:   build:
5:01:45 PM:     command: gridsome build
5:01:45 PM:     commandOrigin: ui
5:01:45 PM:     publish: /opt/build/repo/dist
5:01:45 PM:     publishOrigin: ui
5:01:46 PM: Caching artifacts
5:01:46 PM: Started saving node modules
5:01:46 PM: Finished saving node modules
5:01:46 PM: Started saving build plugins
5:01:46 PM: Finished saving build plugins
5:01:46 PM: Started saving yarn cache
5:01:49 PM: Finished saving yarn cache
5:01:49 PM: Started saving pip cache
5:01:49 PM: Finished saving pip cache
5:01:49 PM: Started saving emacs cask dependencies
5:01:49 PM: Finished saving emacs cask dependencies
5:01:49 PM: Started saving maven dependencies
5:01:49 PM: Finished saving maven dependencies
5:01:49 PM: Started saving boot dependencies
5:01:49 PM: Finished saving boot dependencies
5:01:49 PM: Started saving rust rustup cache
5:01:49 PM: Finished saving rust rustup cache
5:01:49 PM: Started saving go dependencies
5:01:49 PM: Finished saving go dependencies
5:01:52 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:01:52 PM: Creating deploy upload records
5:01:52 PM: Failing build: Failed to build site
5:01:52 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
5:01:52 PM: Finished processing build request in 1m43.648005693s

and the repo is: GitHub - BitInByte/portfolioV2

Thanks one more time :slight_smile:

What happens when you try to implement what the error says?

I tried in the playground but it doesn’t show anything, it just says that there is no subfields and the most weird thing is that if I try to build in my machine it’s working with no problems but on Netlify it doesn’t build…

FWIW @bitinbyte I tried building your project locally and received the same error you receive on Netlify (but not locally.)

Error: Field "image" of type "[Images]" must have a selection of subfields. Did you mean "image { ... }"?

I don’t know what it’s happening, in my machine is working well… I even tried cloning the project and building it in a separate location and it worked… the most weird thing is that, in the playground I can’t select subfields of image

Which branch are you deploying, main or development (which is currently set default)?

Update:
I was able to build locally after cloning. This was the development branch. Had to make one slight alteration. But building on Netlify failed still.

Both branches are the same… that’s what I was talking about, in netlify fails but in local machine doesn’t fails, that’s so weird because the project is already done and I’m literally wasting time in something weird :frowning:

Hope’s will be a solution for this so that I don’t need to remake some lines of code…

Also, thanks for being testing it, I really appreciate it :blush:

Rather than wasting time, think about this as a learning experience. The explanation behind this is quite possibly the overlooking of something so very simple that when it becomes evident :man_facepalming: :woman_facepalming:
And even if it isn’t simple, it is still a learning experience (IMHO.)

That said, have you looked at Netlify CLI? This would enable you to build/deploy from your machine while maintaining the connection to the git repository (as opposed to unlinking at manually deploying.) Then you can have a live site, continue testing/deploying from git and (until a solution is found to the error) update the site via CLI. You can lock to a specific deploy and stop builds altogether. I am not suggesting this as a permanent solution, rather a way to get you going and perhaps explore the platform a little more.

Am sure the right person will come along with the switch for the light bulb moment. :smiley:

I thought on using the netlify cli but I thought that the process was the same that it is used on the website.

Tomorrow I will take a look to the cli and see if I’ll be able to deploy it from there.

Thank you so much coelmay :slight_smile:

This appears to be a problem with Ubuntu. I just tested this repo on macOS and it built fine, but when I tested it with Ubuntu, I get the same error. Since it’s a fresh installation of Ubuntu with nothing connected to Netlify, I believe this error is not local to Netlify.

I think you need to reach out to one of the libraries (probably GraphQL or Gridsome) to ask them why this fails on Ubuntu.

Also, I’m unable to even start the development server where I could use the playground on Ubuntu because of the same error. I tried to remove the image field from the query, but then it complains about the title field.