Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: build failure #107

Closed
bonjourmauko opened this issue Oct 19, 2023 · 10 comments · Fixed by #203
Closed

ci: build failure #107

bonjourmauko opened this issue Oct 19, 2023 · 10 comments · Fixed by #203
Assignees
Labels
build Tout ce qui touche au build et CI

Comments

@bonjourmauko
Copy link
Contributor

bonjourmauko commented Oct 19, 2023

Relates to #168

Bug report

What I did

git push

What I expected to happen

To work.

What actually happened

The build failed in Netlify.

Data (or links to it) that can help you reproduce this issue

6:07:40 PM: > ecospheres-front@0.0.0 build
6:07:40 PM: > vite build
6:07:40 PM: failed to load config from /opt/build/repo/vite.config.js
6:07:40 PM: error during build:
6:07:40 PM: Error: The package "@esbuild/linux-x64" could not be found, and is needed by esbuild.
6:07:40 PM: If you are installing esbuild with npm, make sure that you don"t specify the
"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
6:07:40 PM: of "package.json" is used by esbuild to install the correct binary executable
6:07:40 PM: for your current platform.

@bonjourmauko bonjourmauko added the bug Quelque chose ne fonctionne pas label Oct 19, 2023
@bonjourmauko bonjourmauko added this to the Continuous deployment milestone Oct 19, 2023
@streino
Copy link
Contributor

streino commented Oct 19, 2023

J'ai l'impression que c'est un problème de cache :

2c2
< buildbot version: 298d869feca44c5e485f8709a853be0ddf5d23a7
---
> buildbot version: d5751263049cc87520f39280e992b62dff84a5da
...
21c21,24
< v18.18.2 is already installed.
---
> Downloading and installing node v18.18.2...
> Downloading https://nodejs.org/dist/v18.18.2/node-v18.18.2-linux-x64.tar.xz...
> Computing checksum with sha256sum
> Checksums matched!
32,33c35,36
< up to date, audited 255 packages in 767ms
< 50 packages are looking for funding
---
> added 53 packages, removed 3 packages, changed 15 packages, and audited 411 packages in 1s
> 116 packages are looking for funding
40c43
< "vite" at version "4.5.0"
---
> "vite" at version "4.3.9"

Peut-être une piste dans ce thread ? evanw/esbuild#1819
En particulier exécuter npm ci au lieu de npm install ? Ce qui semble de toutes façons être une bonne pratique, qui plus est adaptée au CI.

@bonjourmauko bonjourmauko removed this from the V1 : Déploiement « version bêta » milestone Oct 26, 2023
@streino
Copy link
Contributor

streino commented Oct 26, 2023

J'ai eu le problème en local à l'instant après un git pull sur mon repo qui datait pas mal :

$ git pull
...
From https://github.com/ecolabdata/ecospheres-front
Updating 91ceaed..a25ba56
...
$ npm install

added 207 packages, removed 6 packages, changed 5 packages, and audited 411 packages in 5m
...

$ npm run dev

> ecospheres-front@0.0.1 dev
> vite

failed to load config from .../ecospheres-front/vite.config.js
error when starting dev server:
Error: The package "@esbuild/linux-x64" could not be found, and is needed by esbuild.

If you are installing esbuild with npm, make sure that you don't specify the
"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
of "package.json" is used by esbuild to install the correct binary executable
for your current platform.
...

Corrigé avec :

$ npm ci

added 410 packages, and audited 411 packages in 11s
...

$ npm run dev

> ecospheres-front@0.0.1 dev
> vite

  VITE v4.3.9  ready in 273 ms
...

@streino
Copy link
Contributor

streino commented Nov 23, 2023

Ça n'a pas l'air d'être possible d'utiliser npm ci avec Netlify : netlify/build-image#172

Il y a un workaround cela dit : https://answers.netlify.com/t/how-can-i-use-npm-ci-instead-of-npm-install/12570/14

@streino
Copy link
Contributor

streino commented Nov 23, 2023

En attendant de voir ce qu'on fait :
Si un build est en échec il suffit de le relancer depuis l'interface de Netlify avec l'option "Clear cache and retry with latest branch commit".

@bonjourmauko bonjourmauko changed the title Build failure ci: build failure Nov 23, 2023
@bonjourmauko bonjourmauko added ci and removed bug Quelque chose ne fonctionne pas labels Nov 23, 2023
@bonjourmauko
Copy link
Contributor Author

En attendant de voir ce qu'on fait : Si un build est en échec il suffit de le relancer depuis l'interface de Netlify avec l'option "Clear cache and retry with latest branch commit".

Je n'ai pas accès à la config du build, mais ce que tu disais sur #107 (comment) me semble être la bonne solution.

Du man npm-ci :

NPM-CI(1)

NAME
npm-ci - Clean install a project

Synopsis
npm ci

     aliases: clean-install, ic, install-clean, isntall-clean

Description
This command is similar to npm help install, except it's meant to be used in automated environments such as test platforms, continuous integration, and deployment -- or any situation where you want to make sure you're doing a clean install of your dependencies.

   The main differences between using npm install and npm ci are:

   •   The project must have an existing package-lock.json or npm-shrinkwrap.json.

   •   If dependencies in the package lock do not match those in package.json, npm ci will exit with an error, instead of updating the package lock.

   •   npm ci can only install entire projects at a time: individual dependencies cannot be added with this command.

   •   If a node_modules is already present, it will be automatically removed before npm ci begins its install.

   •   It will never write to package.json or any of the package-locks: installs are essentially frozen.

@bonjourmauko bonjourmauko removed their assignment Nov 23, 2023
@streino
Copy link
Contributor

streino commented Nov 23, 2023

C'est en théorie la bonne solution, mais Netlify n'offre pas cette option, et le workaround désactive le cache Netlify.

Donc il faut choisir entre :

  1. npm ci mais tous les builds seront plus longs.
  2. default npm install et parfois un retry manuel avec clear cache.

Vu que ça n'arrive pas très souvent (2 fois depuis le début du deploy netlify il me semble), je penche l'option 2 pour l'instant. On pourra basculer si vraiment ça devient gênant.

@bonjourmauko
Copy link
Contributor Author

Je reouvre suite à la discussion sur #168

@bonjourmauko bonjourmauko reopened this Nov 29, 2023
@github-project-automation github-project-automation bot moved this from Shipped to Pool of options in Ecosphères x Multi Nov 29, 2023
@bonjourmauko
Copy link
Contributor Author

@edelagnier sur le sujet esbuild (#168) je n'arrive pas à reproduire l'erreur ni sur Mac ni sur Debian. Si tu as plus d'éléments à partager ce serait cool !

@bonjourmauko
Copy link
Contributor Author

(Cette ligne va rendre inutilisable l'app pour des dév sous Mac et Windows, il faut qu'on trouve une autre solution).

@bonjourmauko
Copy link
Contributor Author

Aha ! @edelagnier t'utilises Docker, n'est-ce pas ?

@github-project-automation github-project-automation bot moved this from Pool of options to Shipped in Ecosphères x Multi Nov 29, 2023
@streino streino added build Tout ce qui touche au build et CI and removed ci labels Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Tout ce qui touche au build et CI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants