From 7a82d1ebe12ce9934eb4d8b18a3636dd9b7c326e Mon Sep 17 00:00:00 2001 From: Julien Rabinow Date: Sun, 8 Jan 2023 01:09:06 -0500 Subject: [PATCH] npm 9 changes Also see https://stackoverflow.com/a/74682436 and https://github.com/npm/cli/pull/5709 --- setup.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 30b8c85..5054fa6 100755 --- a/setup.sh +++ b/setup.sh @@ -78,7 +78,13 @@ function install_vim_plugins() mkdir -p "${HOME}/.local/share/coc/" cd ~/.local/share/coc/extensions if command -v npm > /dev/null && [ "$(whoami)" != root ]; then - npm install --global-style --ignore-scripts --no-bin-links --no-package-lock --only=prod --omit=dev + npm_major_version="$(npm --version | awk -F. '{print $1}')" + if [ "${npm_major_version}" -ge 9 ]; then + opt=--install-strategy=shallow + else + opt=--global-style + fi + npm install "${opt}" --ignore-scripts --no-bin-links --no-package-lock --omit=dev else vim -c "CocDisable" -c quit -c quit fi