web-dev-qa-db-fra.com

Le déploiement de Netlify "a échoué lors de l'étape" chantier ": le script de génération a renvoyé un code de sortie non nul: 42"

J'ai essayé de déployer mon site statique Jekyll sur Netlify (via GitHub) et cela a échoué.

Le message d'erreur était:

"Échec lors de l'étape" chantier ": le script de génération a renvoyé un code de sortie non nul: 42"

Voici le journal Netlify complet:

5:06:23 PM: Preparing Git Reference refs/heads/master
5:06:23 PM: Starting build script
5:06:23 PM: Installing dependencies
5:06:24 PM: Downloading and installing node v10.16.0...
5:06:25 PM: Downloading https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz...
5:06:25 PM: 
##########################
5:06:25 PM:                            37.2%
5:06:25 PM: 
##########################################
5:06:25 PM:                         58.4%
5:06:25 PM: 
################################################
5:06:25 PM: ######################## 100.0%
5:06:25 PM: Computing checksum with sha256sum
5:06:25 PM: Checksums matched!
5:06:28 PM: Now using node v10.16.0 (npm v6.9.0)
5:06:28 PM: Unknown Ruby interpreter version (do not know how to handle): Ruby_VERSION.
5:06:28 PM: Attempting Ruby version 2.6.2, read from environment
5:06:29 PM: Using Ruby version 2.6.2
5:06:29 PM: Using PHP version 5.6
5:06:29 PM: Started restoring cached Ruby gems
5:06:29 PM: Finished restoring cached Ruby gems
5:06:29 PM: Installing gem bundle
5:06:30 PM: Warning: the running version of Bundler (2.0.1) is older than the version that created the lockfile (2.0.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
5:06:31 PM: Fetching gem metadata from https://rubygems.org/
5:06:33 PM: Fetching public_suffix 3.1.1
5:06:33 PM: Installing public_suffix 3.1.1
5:06:33 PM: Fetching addressable 2.6.0
5:06:33 PM: Installing addressable 2.6.0
5:06:33 PM: Using bundler 2.0.1
5:06:33 PM: Fetching colorator 1.1.0
5:06:33 PM: Installing colorator 1.1.0
5:06:33 PM: Fetching concurrent-Ruby 1.1.5
5:06:33 PM: Installing concurrent-Ruby 1.1.5
5:06:33 PM: Fetching eventmachine 1.2.7
5:06:33 PM: Installing eventmachine 1.2.7 with native extensions
5:06:49 PM: Fetching http_parser.rb 0.6.0
5:06:49 PM: Installing http_parser.rb 0.6.0 with native extensions
5:06:50 PM: Fetching em-websocket 0.5.1
5:06:50 PM: Installing em-websocket 0.5.1
5:06:50 PM: Fetching ffi 1.11.1
5:06:51 PM: Installing ffi 1.11.1 with native extensions
5:06:59 PM: Fetching forwardable-extended 2.6.0
5:06:59 PM: Installing forwardable-extended 2.6.0
5:06:59 PM: Fetching i18n 0.9.5
5:06:59 PM: Installing i18n 0.9.5
5:06:59 PM: Fetching rb-fsevent 0.10.3
5:07:00 PM: Installing rb-fsevent 0.10.3
5:07:00 PM: Fetching rb-inotify 0.10.0
5:07:00 PM: Installing rb-inotify 0.10.0
5:07:00 PM: Fetching sass-listen 4.0.0
5:07:00 PM: Installing sass-listen 4.0.0
5:07:00 PM: Fetching sass 3.7.4
5:07:00 PM: Installing sass 3.7.4
5:07:00 PM: Fetching jekyll-sass-converter 1.5.2
5:07:00 PM: Installing jekyll-sass-converter 1.5.2
5:07:00 PM: Fetching Ruby_dep 1.5.0
5:07:00 PM: Installing Ruby_dep 1.5.0
5:07:00 PM: Fetching listen 3.1.5
5:07:00 PM: Installing listen 3.1.5
5:07:00 PM: Fetching jekyll-watch 2.2.1
5:07:00 PM: Installing jekyll-watch 2.2.1
5:07:00 PM: Fetching kramdown 1.17.0
5:07:01 PM: Installing kramdown 1.17.0
5:07:01 PM: Fetching liquid 4.0.3
5:07:01 PM: Installing liquid 4.0.3
5:07:01 PM: Fetching mercenary 0.3.6
5:07:01 PM: Installing mercenary 0.3.6
5:07:01 PM: Fetching pathutil 0.16.2
5:07:01 PM: Installing pathutil 0.16.2
5:07:01 PM: Fetching rouge 3.5.1
5:07:02 PM: Installing rouge 3.5.1
5:07:02 PM: Fetching safe_yaml 1.0.5
5:07:02 PM: Installing safe_yaml 1.0.5
5:07:02 PM: Fetching jekyll 3.8.5
5:07:02 PM: Installing jekyll 3.8.5
5:07:02 PM: Fetching jekyll-feed 0.12.1
5:07:02 PM: Installing jekyll-feed 0.12.1
5:07:02 PM: Fetching jekyll-paginate 1.1.0
5:07:02 PM: Installing jekyll-paginate 1.1.0
5:07:02 PM: Fetching jekyll-seo-tag 2.6.1
5:07:02 PM: Installing jekyll-seo-tag 2.6.1
5:07:02 PM: Fetching jekyll-sitemap 1.3.1
5:07:05 PM: failed during stage 'building site': Build script returned non-zero exit code: 42
5:07:02 PM: Installing jekyll-sitemap 1.3.1
5:07:02 PM: Bundle complete! 4 Gemfile dependencies, 30 gems now installed.
5:07:02 PM: Bundled gems are installed into `/opt/build/cache/bundle`
5:07:02 PM: Post-install message from sass:
5:07:02 PM: Ruby Sass has reached end-of-life and should no longer be used.

Comme la dernière déclaration du journal était:

Ruby Sass a atteint la fin de sa durée de vie et ne doit plus être utilisé.

J'ai fait l'erreur de penser que Ruby Sass était le problème qui nécessitait une résolution. Après avoir attaché mon Gemfile et Gemfile.lock (ainsi que le journal Netlify), @ JayDorsey a gentiment indiqué (dans sa réponse ci-dessous) que le Ruby Sass n'était pas le problème.

MISE À JOUR FINALE: SOLUTION TROUVÉE

Après avoir recherché spécifiquement avec le code d'erreur Netlify "42", j'ai trouvé cet article ( https://jameshfisher.com/2019/01/09/how-to-fix-activating-bundler-2-failed- error-in-your-jekyll-build / ) et cela a résolu l'erreur tout de suite.

La solution qui a fonctionné pour moi a été la suppression

BUNDLED WITH
   2.0.2

de mon Gemfile.lock.

Ce qui suit est mon Gemfile.lock d'origine et vous pouvez remarquer qu'il se termine par le code qui doit être supprimé:

GEM
  remote: https://rubygems.org/
  specs:
    addressable (2.6.0)
      public_suffix (>= 2.0.2, < 4.0)
    colorator (1.1.0)
    concurrent-Ruby (1.1.5)
    em-websocket (0.5.1)
      eventmachine (>= 0.12.9)
      http_parser.rb (~> 0.6.0)
    eventmachine (1.2.7)
    eventmachine (1.2.7-x64-mingw32)
    ffi (1.11.1)
    ffi (1.11.1-x64-mingw32)
    forwardable-extended (2.6.0)
    http_parser.rb (0.6.0)
    i18n (0.9.5)
      concurrent-Ruby (~> 1.0)
    jekyll (3.8.5)
      addressable (~> 2.4)
      colorator (~> 1.0)
      em-websocket (~> 0.5)
      i18n (~> 0.7)
      jekyll-sass-converter (~> 1.0)
      jekyll-watch (~> 2.0)
      kramdown (~> 1.14)
      liquid (~> 4.0)
      mercenary (~> 0.3.3)
      pathutil (~> 0.9)
      rouge (>= 1.7, < 4)
      safe_yaml (~> 1.0)
    jekyll-feed (0.12.1)
      jekyll (>= 3.7, < 5.0)
    jekyll-paginate (1.1.0)
    jekyll-sass-converter (1.5.2)
      sass (~> 3.4)
    jekyll-seo-tag (2.6.1)
      jekyll (>= 3.3, < 5.0)
    jekyll-sitemap (1.3.1)
      jekyll (>= 3.7, < 5.0)
    jekyll-watch (2.2.1)
      listen (~> 3.0)
    kramdown (1.17.0)
    liquid (4.0.3)
    listen (3.1.5)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
      Ruby_dep (~> 1.2)
    mercenary (0.3.6)
    pathutil (0.16.2)
      forwardable-extended (~> 2.6)
    public_suffix (3.1.1)
    rb-fsevent (0.10.3)
    rb-inotify (0.10.0)
      ffi (~> 1.0)
    rouge (3.5.1)
    Ruby_dep (1.5.0)
    safe_yaml (1.0.5)
    sass (3.7.4)
      sass-listen (~> 4.0.0)
    sass-listen (4.0.0)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)

PLATFORMS
  Ruby
  x64-mingw32

DEPENDENCIES
  jekyll-feed
  jekyll-paginate
  jekyll-seo-tag
  jekyll-sitemap

Ruby VERSION
   Ruby 2.6.2p47

BUNDLED WITH
   2.0.2
5
iHaveAQuestion

L'erreur que vous voyez devrait être juste un avertissement et ne devrait pas avoir d'impact sur le déploiement. Je revérifierais les journaux netlify à nouveau et verrais s'il y a une autre erreur que vous pouvez trouver.

La dernière version publiée de jekyll-sass-converter utilise toujours la gemme sass. Il semble qu'ils n'aient pas encore publié de nouvelle version utilisant sassc.

Si vous ajoutez ce qui suit à votre Gemfile, puis exécutez bundle install, Jekyll récupérera la version qui utilise sassc au lieu de sass et vous fera passer l'avertissement que vous voyez

gem 'jekyll-sass-converter', git: 'https://github.com/jekyll/jekyll-sass-converter', branch: 'master'

Si cela ne fonctionne pas, essayez d'abord de créer votre site localement et voyez si vous obtenez des erreurs

0
Jay Dorsey