From bacce909f667ac21fac94ced5a8d35aa7466b279 Mon Sep 17 00:00:00 2001 From: Kyle McCormick Date: Mon, 22 Aug 2022 15:07:07 -0400 Subject: [PATCH] build: in CI, use `npm clean-install` instead of `npm install` Packages can be added to package-lock.json that will fail to install on certain systems. For example, the `fsevents` NPM package, which only works on macOS, was listed as a requirement in the file. `npm install` will happily skip over such packages. `npm clean-install`, however, will exit with a fatal error. Throughout several doc pages, we have recently been encouraging folks to use `clean-install` instead of `install`, because its strictness makes it more reproducible. To ensure that `clean-install` is working reliably at any given time, we should use `clean-install` in our CI pipeline. --- pavelib/prereqs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pavelib/prereqs.py b/pavelib/prereqs.py index 8dca9f8a87..eb732b5b3f 100644 --- a/pavelib/prereqs.py +++ b/pavelib/prereqs.py @@ -139,7 +139,7 @@ def node_prereqs_installation(): else: npm_log_file_path = f'{Env.GEN_LOG_DIR}/npm-install.log' npm_log_file = open(npm_log_file_path, 'wb') # lint-amnesty, pylint: disable=consider-using-with - npm_command = 'npm install --verbose'.split() + npm_command = 'npm clean-install --verbose'.split() # The implementation of Paver's `sh` function returns before the forked # actually returns. Using a Popen object so that we can ensure that @@ -150,12 +150,12 @@ def node_prereqs_installation(): # Error handling around a race condition that produces "cb() never called" error. This # evinces itself as `cb_error_text` and it ought to disappear when we upgrade # npm to 3 or higher. TODO: clean this up when we do that. - print("npm install error detected. Retrying...") + print("npm clean-install error detected. Retrying...") proc = subprocess.Popen(npm_command, stderr=npm_log_file) # lint-amnesty, pylint: disable=consider-using-with retcode = proc.wait() if retcode == 1: raise Exception(f"npm install failed: See {npm_log_file_path}") - print("Successfully installed NPM packages. Log found at {}".format( + print("Successfully clean-installed NPM packages. Log found at {}".format( npm_log_file_path ))