Using a previously working gitlab pipeline gitlab-ci.yml file suddenly hugo can no longer build and it inexplicably can’t find software it clearly just installed globally. Incidentally folks like to say you don’t need to install autoprefixer globally but here it is required.
This project builds locally no problem.
I have already deleted package.json and pasted in the one for docsy 0.7.1, because this seemed like something similar that fixed this the last time I needed to try and fix this pipeline breakage all of a week ago. Now I am suspicious that the packag-lock.json file is also breaking this. Or there is some broken package thing going on with already deleted and perhaps recreated nodue_modules folder.
Also would like to know how the node_modules and package.json thing can be determined and corrected. 77 Packages seems like a lot for a project where I basically just need postcss, postcss-cli and autoprefixer.
See .gitlab-ci.yml
variables:
HUGO_ENV: production
THEME_URL: "github.com/google/docsy@v0.7.1"
CI_DEBUG_TRACE: "true"
DART_SASS_VERSION: 1.63.6
HUGO_VERSION: 0.115.3
NODE_VERSION: 20.x
GIT_DEPTH: 0
GIT_STRATEGY: clone
GIT_SUBMODULE_STRATEGY: recursive
TZ: Europe/Vienna
CI_DEBUG_TRACE: "true"
image:
name: golang:1.20.6-bookworm
pages:
script:
# Install brotli
- apt-get update
- apt-get install -y brotli
# Install Dart Sass
- curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
- tar -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
- cp -r dart-sass/* /usr/local/bin
- rm -rf dart-sass*
# Install Hugo
- curl -LJO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb
- apt-get install -y ./hugo_extended_${HUGO_VERSION}_linux-amd64.deb
- rm hugo_extended_${HUGO_VERSION}_linux-amd64.deb
# Install Node.js
- curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash -
- apt-get install -y nodejs
# Install Node.js dependencies
- "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- npm install -g postcss postcss-cli autoprefixer &&
# Build
- hugo mod get $THEME_URL
- hugo mod graph
- npm install -g postcss postcss-cli autoprefixer &&
- npm ls &&
- hugo mod graph
- hugo --gc --minify
# Compress
- find public -type f -regex '.*\.\(css\|html\|js\|txt\|xml\)$' -exec gzip -f -k {} \;
- find public -type f -regex '.*\.\(css\|html\|js\|txt\|xml\)$' -exec brotli -f -k {} \;
- cp -r ./public ./public_duplicate
# Duplicate the 'public' folder
- grep -rl 'pages.omis.at' ./public_duplicate | xargs sed -i 's/pages.omis.at/doc.omis.at/g'
# Search and replace
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: always
This seemingly functional .gitlab-ci.yml file doesn’t work. Additionally, I would like to know what standard troubleshooting steps can be added to this .gitlab-ci.yml file to identify the breakage and fix it.
++ echo '$ [[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true'
$ [[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true
++ [[ -f package-lock.json ]]
++ [[ -f npm-shrinkwrap.json ]]
++ true
++ echo '$ hugo mod get $THEME_URL'
$ hugo mod get $THEME_URL
++ hugo mod get github.com/google/docsy@v0.7.1
hugo: downloading modules …
hugo: collected modules in 20292 ms
++ echo '$ hugo mod graph'
$ hugo mod graph
++ hugo mod graph
github.com/google/docsy-example github.com/google/docsy@v0.7.1
github.com/google/docsy-example github.com/google/docsy/dependencies@v0.7.1
github.com/google/docsy/dependencies@v0.7.1 github.com/twbs/bootstrap@v5.2.3+incompatible
github.com/google/docsy/dependencies@v0.7.1 github.com/FortAwesome/Font-Awesome@v0.0.0-20230327165841-0698449d50f2
++ echo '$ npm install -g postcss postcss-cli autoprefixer &&'
$ npm install -g postcss postcss-cli autoprefixer &&
++ npm install -g postcss postcss-cli autoprefixer
added 77 packages in 6s
19 packages are looking for funding
run `npm fund` for details
++ echo '$ npm ls &&'
$ npm ls &&
++ npm ls
npm ERR! code ELSPROBLEMS
npm ERR! missing: @fortawesome/fontawesome-free@6.4.0, required by docsy@0.7.2-dev.0-unreleased
npm ERR! extraneous: @nodelib/fs.scandir@2.1.5 /builds/pages/docs/node_modules/@nodelib/fs.scandir
npm ERR! extraneous: @nodelib/fs.stat@2.0.5 /builds/pages/docs/node_modules/@nodelib/fs.stat
npm ERR! extraneous: @nodelib/fs.walk@1.2.8 /builds/pages/docs/node_modules/@nodelib/fs.walk
npm ERR! extraneous: ansi-regex@5.0.1 /builds/pages/docs/node_modules/ansi-regex
npm ERR! extraneous: ansi-styles@4.3.0 /builds/pages/docs/node_modules/ansi-styles
npm ERR! extraneous: anymatch@3.1.3 /builds/pages/docs/node_modules/anymatch
npm ERR! extraneous: argparse@1.0.10 /builds/pages/docs/node_modules/argparse
npm ERR! extraneous: array-union@2.1.0 /builds/pages/docs/node_modules/array-union
npm ERR! extraneous: at-least-node@1.0.0 /builds/pages/docs/node_modules/at-least-node
npm ERR! extraneous: autoprefixer@10.4.14 /builds/pages/docs/node_modules/autoprefixer
npm ERR! extraneous: binary-extensions@2.2.0 /builds/pages/docs/node_modules/binary-extensions
npm ERR! missing: bootstrap@5.2.3, required by docsy@0.7.2-dev.0-unreleased
npm ERR! extraneous: braces@3.0.2 /builds/pages/docs/node_modules/braces
npm ERR! extraneous: browserslist@4.21.9 /builds/pages/docs/node_modules/browserslist
npm ERR! extraneous: caller-callsite@2.0.0 /builds/pages/docs/node_modules/caller-callsite
npm ERR! extraneous: caller-path@2.0.0 /builds/pages/docs/node_modules/caller-path
npm ERR! extraneous: callsites@2.0.0 /builds/pages/docs/node_modules/callsites
npm ERR! extraneous: camelcase@5.3.1 /builds/pages/docs/node_modules/camelcase
npm ERR! extraneous: caniuse-lite@1.0.30001512 /builds/pages/docs/node_modules/caniuse-lite
npm ERR! extraneous: chalk@5.3.0 /builds/pages/docs/node_modules/chalk
npm ERR! extraneous: chokidar@3.5.3 /builds/pages/docs/node_modules/chokidar
npm ERR! extraneous: cliui@8.0.1 /builds/pages/docs/node_modules/cliui
npm ERR! extraneous: color-convert@2.0.1 /builds/pages/docs/node_modules/color-convert
npm ERR! extraneous: color-name@1.1.4 /builds/pages/docs/node_modules/color-name
npm ERR! extraneous: colorette@1.2.1 /builds/pages/docs/node_modules/colorette
npm ERR! extraneous: cosmiconfig@5.2.1 /builds/pages/docs/node_modules/cosmiconfig
npm ERR! extraneous: decamelize@1.2.0 /builds/pages/docs/node_modules/decamelize
npm ERR! extraneous: dependency-graph@0.11.0 /builds/pages/docs/node_modules/dependency-graph
npm ERR! extraneous: dir-glob@3.0.1 /builds/pages/docs/node_modules/dir-glob
npm ERR! extraneous: electron-to-chromium@1.4.451 /builds/pages/docs/node_modules/electron-to-chromium
npm ERR! extraneous: emoji-regex@8.0.0 /builds/pages/docs/node_modules/emoji-regex
npm ERR! extraneous: error-ex@1.3.2 /builds/pages/docs/node_modules/error-ex
npm ERR! extraneous: escalade@3.1.1 /builds/pages/docs/node_modules/escalade
npm ERR! extraneous: escape-string-regexp@1.0.5 /builds/pages/docs/node_modules/escape-string-regexp
npm ERR! extraneous: esprima@4.0.1 /builds/pages/docs/node_modules/esprima
npm ERR! extraneous: fast-glob@3.3.0 /builds/pages/docs/node_modules/fast-glob
npm ERR! extraneous: fastq@1.15.0 /builds/pages/docs/node_modules/fastq
npm ERR! extraneous: fill-range@7.0.1 /builds/pages/docs/node_modules/fill-range
npm ERR! extraneous: find-up@6.3.0 /builds/pages/docs/node_modules/find-up
npm ERR! extraneous: fs-extra@11.1.1 /builds/pages/docs/node_modules/fs-extra
npm ERR! extraneous: get-caller-file@2.0.5 /builds/pages/docs/node_modules/get-caller-file
npm ERR! extraneous: get-stdin@9.0.0 /builds/pages/docs/node_modules/get-stdin
npm ERR! extraneous: glob-parent@5.1.2 /builds/pages/docs/node_modules/glob-parent
npm ERR! extraneous: globby@13.2.2 /builds/pages/docs/node_modules/globby
npm ERR! extraneous: graceful-fs@4.2.11 /builds/pages/docs/node_modules/graceful-fs
npm ERR! extraneous: has-flag@3.0.0 /builds/pages/docs/node_modules/has-flag
npm ERR! missing: hugo-extended@0.115.1, required by docsy@0.7.2-dev.0-unreleased
npm ERR! extraneous: ignore@5.2.4 /builds/pages/docs/node_modules/ignore
npm ERR! extraneous: import-cwd@2.1.0 /builds/pages/docs/node_modules/import-cwd
npm ERR! extraneous: import-fresh@2.0.0 /builds/pages/docs/node_modules/import-fresh
npm ERR! extraneous: import-from@2.1.0 /builds/pages/docs/node_modules/import-from
npm ERR! extraneous: is-arrayish@0.2.1 /builds/pages/docs/node_modules/is-arrayish
npm ERR! extraneous: is-binary-path@2.1.0 /builds/pages/docs/node_modules/is-binary-path
npm ERR! extraneous: is-directory@0.3.1 /builds/pages/docs/node_modules/is-directory
npm ERR! extraneous: is-extglob@2.1.1 /builds/pages/docs/node_modules/is-extglob
npm ERR! extraneous: is-fullwidth-code-point@3.0.0 /builds/pages/docs/node_modules/is-fullwidth-code-point
npm ERR! extraneous: is-glob@4.0.3 /builds/pages/docs/node_modules/is-glob
npm ERR! extraneous: is-number@7.0.0 /builds/pages/docs/node_modules/is-number
npm ERR! extraneous: js-yaml@3.14.0 /builds/pages/docs/node_modules/js-yaml
npm ERR! extraneous: json-parse-better-errors@1.0.2 /builds/pages/docs/node_modules/json-parse-better-errors
npm ERR! extraneous: jsonfile@6.1.0 /builds/pages/docs/node_modules/jsonfile
npm ERR! extraneous: locate-path@7.2.0 /builds/pages/docs/node_modules/locate-path
npm ERR! extraneous: lodash@4.17.21 /builds/pages/docs/node_modules/lodash
npm ERR! extraneous: log-symbols@5.1.0 /builds/pages/docs/node_modules/log-symbols
npm ERR! extraneous: merge2@1.4.1 /builds/pages/docs/node_modules/merge2
npm ERR! extraneous: micromatch@4.0.5 /builds/pages/docs/node_modules/micromatch
npm ERR! extraneous: nanoid@3.3.6 /builds/pages/docs/node_modules/nanoid
npm ERR! extraneous: node-releases@2.0.12 /builds/pages/docs/node_modules/node-releases
npm ERR! extraneous: normalize-path@3.0.0 /builds/pages/docs/node_modules/normalize-path
npm ERR! extraneous: normalize-range@0.1.2 /builds/pages/docs/node_modules/normalize-range
npm ERR! extraneous: num2fraction@1.2.2 /builds/pages/docs/node_modules/num2fraction
npm ERR! extraneous: p-limit@4.0.0 /builds/pages/docs/node_modules/p-limit
npm ERR! extraneous: p-locate@6.0.0 /builds/pages/docs/node_modules/p-locate
npm ERR! extraneous: p-try@2.2.0 /builds/pages/docs/node_modules/p-try
npm ERR! extraneous: parse-json@5.2.0 /builds/pages/docs/node_modules/parse-json
npm ERR! extraneous: path-exists@5.0.0 /builds/pages/docs/node_modules/path-exists
npm ERR! extraneous: path-type@4.0.0 /builds/pages/docs/node_modules/path-type
npm ERR! extraneous: picocolors@1.0.0 /builds/pages/docs/node_modules/picocolors
npm ERR! extraneous: picomatch@2.3.1 /builds/pages/docs/node_modules/picomatch
npm ERR! extraneous: pify@2.3.0 /builds/pages/docs/node_modules/pify
npm ERR! extraneous: postcss-cli@10.1.0 /builds/pages/docs/node_modules/postcss-cli
npm ERR! extraneous: postcss-load-config@4.0.1 /builds/pages/docs/node_modules/postcss-load-config
npm ERR! extraneous: postcss-reporter@7.0.5 /builds/pages/docs/node_modules/postcss-reporter
npm ERR! extraneous: postcss-value-parser@4.2.0 /builds/pages/docs/node_modules/postcss-value-parser
npm ERR! extraneous: postcss@8.4.25 /builds/pages/docs/node_modules/postcss
npm ERR! extraneous: pretty-hrtime@1.0.3 /builds/pages/docs/node_modules/pretty-hrtime
npm ERR! extraneous: read-cache@1.0.0 /builds/pages/docs/node_modules/read-cache
npm ERR! extraneous: readdirp@3.6.0 /builds/pages/docs/node_modules/readdirp
npm ERR! extraneous: require-directory@2.1.1 /builds/pages/docs/node_modules/require-directory
npm ERR! extraneous: require-main-filename@2.0.0 /builds/pages/docs/node_modules/require-main-filename
npm ERR! extraneous: resolve-from@3.0.0 /builds/pages/docs/node_modules/resolve-from
npm ERR! extraneous: reusify@1.0.4 /builds/pages/docs/node_modules/reusify
npm ERR! extraneous: run-parallel@1.2.0 /builds/pages/docs/node_modules/run-parallel
npm ERR! extraneous: set-blocking@2.0.0 /builds/pages/docs/node_modules/set-blocking
npm ERR! extraneous: slash@5.1.0 /builds/pages/docs/node_modules/slash
npm ERR! extraneous: source-map-js@1.0.2 /builds/pages/docs/node_modules/source-map-js
npm ERR! extraneous: source-map@0.6.1 /builds/pages/docs/node_modules/source-map
npm ERR! extraneous: sprintf-js@1.0.3 /builds/pages/docs/node_modules/sprintf-js
npm ERR! extraneous: string-width@4.2.3 /builds/pages/docs/node_modules/string-width
npm ERR! extraneous: strip-ansi@6.0.1 /builds/pages/docs/node_modules/strip-ansi
npm ERR! extraneous: to-regex-range@5.0.1 /builds/pages/docs/node_modules/to-regex-range
npm ERR! extraneous: universalify@2.0.0 /builds/pages/docs/node_modules/universalify
npm ERR! extraneous: update-browserslist-db@1.0.11 /builds/pages/docs/node_modules/update-browserslist-db
npm ERR! extraneous: which-module@2.0.0 /builds/pages/docs/node_modules/which-module
npm ERR! extraneous: wrap-ansi@7.0.0 /builds/pages/docs/node_modules/wrap-ansi
npm ERR! extraneous: y18n@5.0.8 /builds/pages/docs/node_modules/y18n
npm ERR! extraneous: yargs-parser@21.1.1 /builds/pages/docs/node_modules/yargs-parser
npm ERR! extraneous: yargs@17.7.2 /builds/pages/docs/node_modules/yargs
npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-07-24T12_31_53_476Z-debug-0.log
docsy@0.7.2-dev.0-unreleased /builds/pages/docs
+-- UNMET DEPENDENCY @fortawesome/fontawesome-free@6.4.0
+-- @nodelib/fs.scandir@2.1.5 extraneous
+-- @nodelib/fs.stat@2.0.5 extraneous
+-- @nodelib/fs.walk@1.2.8 extraneous
+-- ansi-regex@5.0.1 extraneous
+-- ansi-styles@4.3.0 extraneous
+-- anymatch@3.1.3 extraneous
+-- argparse@1.0.10 extraneous
+-- array-union@2.1.0 extraneous
+-- at-least-node@1.0.0 extraneous
+-- autoprefixer@10.4.14 extraneous
+-- binary-extensions@2.2.0 extraneous
+-- UNMET DEPENDENCY bootstrap@5.2.3
+-- braces@3.0.2 extraneous
+-- browserslist@4.21.9 extraneous
+-- caller-callsite@2.0.0 extraneous
+-- caller-path@2.0.0 extraneous
+-- callsites@2.0.0 extraneous
+-- camelcase@5.3.1 extraneous
+-- caniuse-lite@1.0.30001512 extraneous
+-- chalk@5.3.0 extraneous
+-- chokidar@3.5.3 extraneous
+-- cliui@8.0.1 extraneous
+-- color-convert@2.0.1 extraneous
+-- color-name@1.1.4 extraneous
+-- colorette@1.2.1 extraneous
+-- cosmiconfig@5.2.1 extraneous
+-- decamelize@1.2.0 extraneous
+-- dependency-graph@0.11.0 extraneous
+-- dir-glob@3.0.1 extraneous
+-- electron-to-chromium@1.4.451 extraneous
+-- emoji-regex@8.0.0 extraneous
+-- error-ex@1.3.2 extraneous
+-- escalade@3.1.1 extraneous
+-- escape-string-regexp@1.0.5 extraneous
+-- esprima@4.0.1 extraneous
+-- fast-glob@3.3.0 extraneous
+-- fastq@1.15.0 extraneous
+-- fill-range@7.0.1 extraneous
+-- find-up@6.3.0 extraneous
+-- fs-extra@11.1.1 extraneous
+-- get-caller-file@2.0.5 extraneous
+-- get-stdin@9.0.0 extraneous
+-- glob-parent@5.1.2 extraneous
+-- globby@13.2.2 extraneous
+-- graceful-fs@4.2.11 extraneous
+-- has-flag@3.0.0 extraneous
+-- UNMET DEPENDENCY hugo-extended@0.115.1
+-- ignore@5.2.4 extraneous
+-- import-cwd@2.1.0 extraneous
+-- import-fresh@2.0.0 extraneous
+-- import-from@2.1.0 extraneous
+-- is-arrayish@0.2.1 extraneous
+-- is-binary-path@2.1.0 extraneous
+-- is-directory@0.3.1 extraneous
+-- is-extglob@2.1.1 extraneous
+-- is-fullwidth-code-point@3.0.0 extraneous
+-- is-glob@4.0.3 extraneous
+-- is-number@7.0.0 extraneous
+-- js-yaml@3.14.0 extraneous
+-- json-parse-better-errors@1.0.2 extraneous
+-- jsonfile@6.1.0 extraneous
+-- locate-path@7.2.0 extraneous
+-- lodash@4.17.21 extraneous
+-- log-symbols@5.1.0 extraneous
+-- merge2@1.4.1 extraneous
+-- micromatch@4.0.5 extraneous
+-- nanoid@3.3.6 extraneous
+-- node-releases@2.0.12 extraneous
+-- normalize-path@3.0.0 extraneous
+-- normalize-range@0.1.2 extraneous
+-- num2fraction@1.2.2 extraneous
+-- p-limit@4.0.0 extraneous
+-- p-locate@6.0.0 extraneous
+-- p-try@2.2.0 extraneous
+-- parse-json@5.2.0 extraneous
+-- path-exists@5.0.0 extraneous
+-- path-type@4.0.0 extraneous
+-- picocolors@1.0.0 extraneous
+-- picomatch@2.3.1 extraneous
+-- pify@2.3.0 extraneous
+-- postcss-cli@10.1.0 extraneous
+-- postcss-load-config@4.0.1 extraneous
+-- postcss-reporter@7.0.5 extraneous
+-- postcss-value-parser@4.2.0 extraneous
+-- postcss@8.4.25 extraneous
+-- pretty-hrtime@1.0.3 extraneous
+-- read-cache@1.0.0 extraneous
+-- readdirp@3.6.0 extraneous
+-- require-directory@2.1.1 extraneous
+-- require-main-filename@2.0.0 extraneous
+-- resolve-from@3.0.0 extraneous
+-- reusify@1.0.4 extraneous
+-- run-parallel@1.2.0 extraneous
+-- set-blocking@2.0.0 extraneous
+-- slash@5.1.0 extraneous
+-- source-map-js@1.0.2 extraneous
+-- source-map@0.6.1 extraneous
+-- sprintf-js@1.0.3 extraneous
+-- string-width@4.2.3 extraneous
+-- strip-ansi@6.0.1 extraneous
+-- to-regex-range@5.0.1 extraneous
+-- universalify@2.0.0 extraneous
+-- update-browserslist-db@1.0.11 extraneous
+-- which-module@2.0.0 extraneous
+-- wrap-ansi@7.0.0 extraneous
+-- y18n@5.0.8 extraneous
+-- yargs-parser@21.1.1 extraneous
`-- yargs@17.7.2 extraneous
++ hugo mod graph
github.com/google/docsy-example github.com/google/docsy@v0.7.1
github.com/google/docsy-example github.com/google/docsy/dependencies@v0.7.1
github.com/google/docsy/dependencies@v0.7.1 github.com/twbs/bootstrap@v5.2.3+incompatible
github.com/google/docsy/dependencies@v0.7.1 github.com/FortAwesome/Font-Awesome@v0.0.0-20230327165841-0698449d50f2
++ echo '$ hugo --gc --minify'
$ hugo --gc --minify
++ hugo --gc --minify
Start building sites …
hugo v0.115.3-5c2e014a5150553a9fa4f9c1eb7dc4db89c0f1ab+extended linux/amd64 BuildDate=2023-07-13T16:11:34Z VendorInfo=gohugoio
WARN .File.UniqueID on zero object. Wrap it in if or with: {{ with .File }}{{ .UniqueID }}{{ end }}
Total in 2949 ms
Error: error building site: POSTCSS: failed to transform "scss/main.css" (text/css): Error: Loading PostCSS Plugin failed: Cannot find module './vendor'
Require stack:
- /builds/pages/docs/node_modules/autoprefixer/lib/prefixes.js
- /builds/pages/docs/node_modules/autoprefixer/lib/autoprefixer.js
- /builds/pages/docs/postcss.config.js
(@/builds/pages/docs/postcss.config.js)
at load (/usr/lib/node_modules/postcss-cli/node_modules/postcss-load-config/src/plugins.js:28:11)
at /usr/lib/node_modules/postcss-cli/node_modules/postcss-load-config/src/plugins.js:53:16
at Array.map (<anonymous>)
at plugins (/usr/lib/node_modules/postcss-cli/node_modules/postcss-load-config/src/plugins.js:52:8)
at processResult (/usr/lib/node_modules/postcss-cli/node_modules/postcss-load-config/src/index.js:38:14)
at /usr/lib/node_modules/postcss-cli/node_modules/postcss-load-config/src/index.js:162:14
at async Promise.all (index 0)
npm notice
npm notice New patch version of npm available! 9.8.0 -> 9.8.1
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.8.1>
npm notice Run `npm install -g npm@9.8.1` to update!
npm notice
Cleaning up project directory and file based variables
00:00
+ grep pipefail
+ set -o
+ set -o pipefail
+ set -o errexit
+ set +o noclobber
+ eval '$'\''rm'\'' -f /builds/pages/docs.tmp/CI_SERVER_TLS_CA_FILE
'
++ rm -f /builds/pages/docs.tmp/CI_SERVER_TLS_CA_FILE
+ :
+ exit 0