Search code examples
javascriptvuejs2nuxt.jsnetlifystoryblok

Netlify Deployment (Nuxt - Storyblok CMS project) failure. `Failed during stage 'building site': Build script returned non-zero exit code: 1`


Solved! Look bellow for more details. (It was a typo mistake)





I am trying to Deploy a project in Netlify as Static using npm run generate but I am getting an error of failed during stage 'building site': Build script returned non-zero exit code: 1. I have previously deployed 2 other projects in Netlify (they weren't using Storyblok, only Nuxt) and I haven't had such an error before.

The project uses Nuxt Js (Vue Js framework), Vuetify and Storyblok Headless CMS with asyncData methods calling the requests. I have implemented it the way Storyblok's documentation says, especially the generation of the routes in nuxt.config.js, the dynamically change of the version (draft - published), using the storyblok-nuxt module for the requests, setting up Storyblok space and creating the tokens (draft - published), the desired components and content.

Everything works fine, both locally as npm run dev (development mode) and using npm run generate (local production mode). I tested the second using the http-server, it worked completely normally.

I tried :

1). Re-deploying without cache even.

2). Running locally npm run audit and then npm run audit fix to fix some vulnerabilities (to check if they were the problem by any chance).

3). Updated Nuxt to the newest version (it was 2.4.0 i think and I updated to 2.8.1.

4). I also tried commenting out the generation of the dynamic routes in the nuxt.config.js (so only the standard routes would be generated) to see if the dynamic routes are the problem but still similar error again.

The complete log in the Netlify Deployment is :

8:04:24 PM: Build ready to start
8:04:26 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
8:04:26 PM: build-image tag: v3.3.2
8:04:26 PM: buildbot version: 75cd99f62ada9e21edea53208e8baf0eab85a045
8:04:26 PM: Fetching cached dependencies
8:04:26 PM: Starting to download cache of 255.0KB
8:04:26 PM: Finished downloading cache in 92.256738ms
8:04:26 PM: Starting to extract cache
8:04:26 PM: Failed to fetch cache, continuing with build
8:04:26 PM: Starting to prepare the repo for build
8:04:27 PM: No cached dependencies found. Cloning fresh repo
8:04:27 PM: git clone https://github.com/alexgil1994/sofokliskourtidis
8:04:28 PM: Preparing Git Reference refs/heads/master
8:04:28 PM: Starting build script
8:04:28 PM: Installing dependencies
8:04:29 PM: Downloading and installing node v10.16.0...
8:04:30 PM: Downloading https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz...
8:04:30 PM: 
################################
8:04:30 PM:                            44.9%
8:04:30 PM: 
##################################################
8:04:30 PM: ###################### 100.0%
8:04:30 PM: Computing checksum with sha256sum
8:04:30 PM: Checksums matched!
8:04:33 PM: Now using node v10.16.0 (npm v6.9.0)
8:04:33 PM: Attempting ruby version 2.6.2, read from environment
8:04:34 PM: Using ruby version 2.6.2
8:04:35 PM: Using PHP version 5.6
8:04:35 PM: Started restoring cached node modules
8:04:35 PM: Finished restoring cached node modules
8:04:35 PM: Installing NPM modules using NPM version 6.9.0
8:04:59 PM: > [email protected] postinstall /opt/build/repo/node_modules/core-js-pure
8:04:59 PM: > node scripts/postinstall || echo "ignore"
8:04:59 PM: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
8:04:59 PM: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
8:04:59 PM: > https://opencollective.com/core-js 
8:04:59 PM: > https://www.patreon.com/zloirock 
8:04:59 PM: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
8:04:59 PM: > [email protected] postinstall /opt/build/repo/node_modules/nodemon
8:04:59 PM: > node bin/postinstall || exit 0
8:04:59 PM: Love nodemon? You can now support the project via the open collective:
8:04:59 PM:  > https://opencollective.com/nodemon/donate
8:04:59 PM: > [email protected] postinstall /opt/build/repo/node_modules/nuxt
8:04:59 PM: > opencollective || exit 0
8:05:00 PM:                                      :-:
8:05:00 PM:                                    .==-+:
8:05:00 PM:                                   .==. :+- .-=-
8:05:00 PM:                                  .==.   :==++-+=.
8:05:00 PM:                                 :==.     -**: :+=.
8:05:00 PM:                                :+-      :*+++. .++.
8:05:00 PM:                               :+-      -*= .++: .=+.
8:05:00 PM:                              -+:      =*-   .+*: .=+:
8:05:00 PM:                             -+:     .=*-     .=*-  =+:
8:05:00 PM:                           .==:     .+*:        -*-  -+-
8:05:00 PM:                          .=+:.....:+*-.........:=*=..=*-
8:05:00 PM:                          .-=------=++============++====:
8:05:00 PM:                           Thanks for installing nuxtjs
8:05:00 PM:                  Please consider donating to our open collective
8:05:00 PM:                         to help us maintain this package.
8:05:00 PM:                            Number of contributors: 204
8:05:00 PM:                               Number of backers: 217
8:05:00 PM:                               Annual budget: $49,368
8:05:00 PM:                              Current balance: $10,815
8:05:00 PM:                  Donate: https://opencollective.com/nuxtjs/donate
8:05:01 PM: npm WARN
8:05:01 PM: optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/@nuxt/builder/node_modules/fsevents):
8:05:01 PM: npm
8:05:01 PM:  WARN notsup
8:05:01 PM:  SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
8:05:01 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
8:05:01 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
8:05:01 PM: added 1178 packages from 583 contributors and audited 13223 packages in 25.237s
8:05:01 PM: found 0 vulnerabilities
8:05:01 PM: NPM modules installed
8:05:01 PM: Started restoring cached go cache
8:05:01 PM: Finished restoring cached go cache
8:05:02 PM: unset GOOS;
8:05:02 PM: unset GOARCH;
8:05:02 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
8:05:02 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
8:05:02 PM: go version >&2;
8:05:02 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
8:05:02 PM: go version go1.12 linux/amd64
8:05:02 PM: Installing missing commands
8:05:02 PM: Verify run directory
8:05:02 PM: Executing user command: npm run generate
8:05:02 PM: > [email protected] generate /opt/build/repo
8:05:02 PM: > nuxt generate
8:05:05 PM: ℹ Production build
8:05:05 PM: ✔ Builder initialized
8:05:05 PM: ✔ Nuxt files generated
8:05:08 PM: ℹ Compiling Client
8:05:57 PM: ✔ Client: Compiled with some errors in 49.73s
8:05:57 PM: Hash: e377ffadaa01340e2904
8:05:57 PM: Version: webpack 4.33.0
8:05:57 PM: Time: 49736ms
8:05:57 PM: Built at: 06/11/2019 5:05:57 PM
8:05:57 PM:                                Asset       Size  Chunks  Chunk Names
8:05:57 PM:              05d6065413b138f1d7e5.js   11.9 KiB       8  pages/articles/posts/tags/_tag/page/_pageNum
8:05:57 PM:              0c60ef31c5ef98553702.js   6.12 KiB      38  pages/regional/posts/overview/index
8:05:57 PM:              11941b79ce20754bb795.js   1.65 KiB      31  pages/photography/posts/_id
8:05:57 PM:              14737906e17b8a20ffe4.js   4.83 KiB       9  pages/articles/posts/tags/index
8:05:57 PM:              16748f01034580cf9a1f.js   11.9 KiB      15  pages/literature-poetry/posts/search/page/_pageNum
8:05:57 PM:              16e42f3698c4cf474170.js   1.62 KiB      19  pages/movies/posts/_id
8:05:57 PM:              17399e159d7a5c9fd4ed.js   11.8 KiB      27  pages/music/posts/search/page/_pageNum
8:06:00 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
8:05:57 PM:              2cf93be146656923f6a9.js   1.69 KiB      13  pages/literature-poetry/posts/_id
8:05:57 PM:              300ad3ecf659adc49691.js   2.14 KiB       3  pages/about
8:05:57 PM:              498a6373a91c5639c50c.js   1.61 KiB      25  pages/music/posts/_id
8:06:01 PM: Shutting down logging, 104 messages pending

The expectation is to see all the routes being generated (normal ones and dynamic ones) and the crash happens I believe before any routes are being created (this happens later in the generation. Also I would like to say that the moment that the crash is being thrown isn't the same with each re deployment, it is in the similar spot and time but it has happened showing also something like this or (which is a bit farther) and also earlier but always after the client generation happens :

11:11:57 PM: Build ready to start
11:11:59 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
11:11:59 PM: build-image tag: v3.3.2
11:11:59 PM: buildbot version: 75cd99f62ada9e21edea53208e8baf0eab85a045
11:12:00 PM: Fetching cached dependencies
11:12:00 PM: Failed to fetch cache, continuing with build
11:12:00 PM: Starting to prepare the repo for build
11:12:00 PM: No cached dependencies found. Cloning fresh repo
11:12:00 PM: git clone https://github.com/alexgil1994/sofokliskourtidis
11:12:05 PM: Preparing Git Reference refs/heads/master
11:12:07 PM: Starting build script
11:12:07 PM: Installing dependencies
11:12:08 PM: Downloading and installing node v10.16.0...
11:12:09 PM: Downloading https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz...
11:12:09 PM: 
################
11:12:09 PM:    22.7%
11:12:09 PM: 
#########################################
11:12:09 PM: ###################              84.0%
11:12:09 PM: 
######################################################################## 100.0%
11:12:09 PM: Computing checksum with sha256sum
11:12:09 PM: Checksums matched!
11:12:12 PM: Now using node v10.16.0 (npm v6.9.0)
11:12:12 PM: Attempting ruby version 2.6.2, read from environment
11:12:13 PM: Using ruby version 2.6.2
11:12:13 PM: Using PHP version 5.6
11:12:13 PM: Started restoring cached node modules
11:12:13 PM: Finished restoring cached node modules
11:12:14 PM: Installing NPM modules using NPM version 6.9.0
11:12:36 PM: > [email protected] postinstall /opt/build/repo/node_modules/core-js-pure
11:12:36 PM: > node scripts/postinstall || echo "ignore"
11:12:37 PM: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
11:12:37 PM: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
11:12:37 PM: > https://opencollective.com/core-js 
11:12:37 PM: > https://www.patreon.com/zloirock 
11:12:37 PM: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
11:12:37 PM: > [email protected] postinstall /opt/build/repo/node_modules/nodemon
11:12:37 PM: > node bin/postinstall || exit 0
11:12:37 PM: Love nodemon? You can now support the project via the open collective:
11:12:37 PM:  > https://opencollective.com/nodemon/donate
11:12:37 PM: > [email protected] postinstall /opt/build/repo/node_modules/nuxt
11:12:37 PM: > opencollective || exit 0
11:12:37 PM:                                      :-:
11:12:37 PM:                                    .==-+:
11:12:37 PM:                                   .==. :+- .-=-
11:12:37 PM:                                  .==.   :==++-+=.
11:12:37 PM:                                 :==.     -**: :+=.
11:12:37 PM:                                :+-      :*+++. .++.
11:12:37 PM:                               :+-      -*= .++: .=+.
11:12:37 PM:                              -+:      =*-   .+*: .=+:
11:12:37 PM:                             -+:     .=*-     .=*-  =+:
11:12:37 PM:                           .==:     .+*:        -*-  -+-
11:12:37 PM:                          .=+:.....:+*-.........:=*=..=*-
11:12:37 PM:                          .-=------=++============++====:
11:12:37 PM:                           Thanks for installing nuxtjs
11:12:37 PM:                  Please consider donating to our open collective
11:12:37 PM:                         to help us maintain this package.
11:12:37 PM:                            Number of contributors: 204
11:12:37 PM:                               Number of backers: 217
11:12:37 PM:                               Annual budget: $49,368
11:12:37 PM:                              Current balance: $10,815
11:12:37 PM:                  Donate: https://opencollective.com/nuxtjs/donate
11:12:39 PM: npm
11:12:39 PM:  WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/@nuxt/builder/node_modules/fsevents):
11:12:39 PM: npm WARN
11:12:39 PM: notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
11:12:39 PM: npm
11:12:39 PM:  WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
11:12:39 PM: npm
11:12:39 PM: WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
11:12:39 PM: added 1178 packages from 583 contributors and audited 13223 packages in 24.18s
11:12:39 PM: found 0 vulnerabilities
11:12:39 PM: NPM modules installed
11:12:39 PM: Started restoring cached go cache
11:12:39 PM: Finished restoring cached go cache
11:12:39 PM: unset GOOS;
11:12:39 PM: unset GOARCH;
11:12:39 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
11:12:39 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
11:12:39 PM: go version >&2;
11:12:39 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
11:12:39 PM: go version go1.12 linux/amd64
11:12:39 PM: Installing missing commands
11:12:39 PM: Verify run directory
11:12:39 PM: Executing user command: npm run generate
11:12:39 PM: > [email protected] generate /opt/build/repo
11:12:39 PM: > nuxt generate
11:12:42 PM: ℹ Production build
11:12:43 PM: ✔ Builder initialized
11:12:43 PM: ✔ Nuxt files generated
11:12:45 PM: ℹ Compiling Client
11:13:38 PM: ✔ Client: Compiled with some errors in 53.34s
11:13:38 PM: Hash: e377ffadaa01340e2904
11:13:38 PM: Version: webpack 4.33.0
11:13:38 PM: Time: 53344ms
11:13:38 PM: Built at: 06/11/2019 8:13:38 PM
11:13:38 PM:                                Asset       Size  Chunks  Chunk Names
11:13:38 PM:              05d6065413b138f1d7e5.js   11.9 KiB       8  pages/articles/posts/tags/_tag/page/_pageNum
11:13:38 PM:              0c60ef31c5ef98553702.js   6.12 KiB      38  pages/regional/posts/overview/index
11:13:38 PM:              11941b79ce20754bb795.js   1.65 KiB      31  pages/photography/posts/_id
11:13:38 PM:              14737906e17b8a20ffe4.js   4.83 KiB       9  pages/articles/posts/tags/index
11:13:38 PM:              16748f01034580cf9a1f.js   11.9 KiB      15  pages/literature-poetry/posts/search/page/_pageNum
11:13:38 PM:              16e42f3698c4cf474170.js   1.62 KiB      19  pages/movies/posts/_id
11:13:38 PM:              17399e159d7a5c9fd4ed.js   11.8 KiB      27  pages/music/posts/search/page/_pageNum
11:13:38 PM:              2cf93be146656923f6a9.js   1.69 KiB      13  pages/literature-poetry/posts/_id
11:13:38 PM:              300ad3ecf659adc49691.js   2.14 KiB       3  pages/about
11:13:38 PM:              498a6373a91c5639c50c.js   1.61 KiB      25  pages/music/posts/_id
11:13:38 PM:              4e7c5059bd22566047bc.js   11.9 KiB      22  pages/movies/posts/tags/_tag/page/_pageNum
11:13:38 PM:              5703fdcb34c21e9010b9.js   6.02 KiB      20  pages/movies/posts/overview/index
11:13:38 PM:              590c5bb6b402a8e95872.js   6.25 KiB      10  pages/contact
11:13:38 PM:              5f172f247c5bdae3d529.js   11.8 KiB      21  pages/movies/posts/search/page/_pageNum
11:13:38 PM:              62aee38098ef0d84345a.js   12.6 KiB       4  pages/articles/index
11:13:38 PM:              62ca27f64ea11dbd388e.js   12.7 KiB      12  pages/literature-poetry/index
11:13:38 PM:              68570d73d3cc0726e0e1.js   11.8 KiB      33  pages/photography/posts/search/page/_pageNum
11:13:38 PM:              695064e2d97bbf093667.js   12.6 KiB      24  pages/music/index
11:13:38 PM:              69c29103b8a3228e38b8.js    113 KiB       1  app
11:13:38 PM:              6bee9e9833e8dfea8b0e.js   11.9 KiB      39  pages/regional/posts/search/page/_pageNum
11:13:38 PM:              6d59a37cdf09bf0bed9c.js    194 KiB       2  commons.app
11:13:38 PM:              6e556836004cc7d77285.js   65.6 KiB      46  vendors.pages/contact
11:13:38 PM:              715e27e7e7ebe62980e4.js   2.08 KiB      43  pages/termsconditions
11:13:38 PM:              8e3688fb9c457755f170.js   6.11 KiB      14  pages/literature-poetry/posts/overview/index
11:13:38 PM:              9b48190ec2f9aad78cda.js   3.09 KiB      42  pages/resume
11:13:42 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
11:13:38 PM:              9cd775f3c147971c7a28.js   12.6 KiB      30  pages/photography/index
11:13:38 PM:                             LICENSES  582 bytes          
11:13:43 PM: Shutting down logging, 85 messages pending

In contrast when I run npm run generate locally all the requests towards Storyblok (using Axios) happen creating all the expected routes without any error or warning.

I didn't share the repository since it is a private repository and has tokens inside but if there are any informations that are needed please tell me so. If there is any idea to try in order to fix it please enlighten me and thank you for your time.


Solution

  • I found the solution, it didn't have anything to do with either Nuxt specifically, Storyblok or anything else, it was basically a typo mistake.

    I started cleaning up a bit the project from potential console.log(...) that I had in various places, the idea was to see if this way the Netlify log would give me more details since they wouldn't be hidden from the console.logs.

    After the clean up and the git push the next deploy had indeed a more clear error output in the console which helped me track the spot with the mistake. It was in a SectionImage SVG Component that was basically with Nuxt's module for SVGs, I had written the name attribute as Sectionimage. So after fixing it everything worked perfectly!





    (Nuxt - Vue - Vuetify and Storyblok (first time used it) rock! :D )