tools: update-eslint.sh does not work with npm@7 #37560
Closed
Description
- Version: v15.10.0, npm version 7.5.3
- Platform: Darwin imac.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
- Subsystem: tools
What steps will reproduce the bug?
Running the tools/update-eslint.sh
with npm@7
fails with the following error:
npm ERR! code ERESOLVE
npm ERR! Cannot destructure property 'name' of 'node' as it is null.
How often does it reproduce? Is there a required condition?
Always. No required condition.
What is the expected behavior?
The script works without errors.
What do you see instead?
See above.
Additional information
Using the --legacy-peer-deps
flag to install eslint-plugin-markdown
does not help as it produces a new issue where the eslint-tmp/node_modules/eslint
folder is removed.
I can only make it work with something like this
diff --git a/tools/update-eslint.sh b/tools/update-eslint.sh
index d0320ab8f8..69dab66a2c 100755
--- a/tools/update-eslint.sh
+++ b/tools/update-eslint.sh
@@ -8,20 +8,14 @@
# $BASH_SOURCE[0] to determine directories to work in.
cd "$( dirname "$0" )" || exit
-rm -rf node_modules/eslint
+rm -rf node_modules/eslint node_modules/eslint-plugin-markdown
(
mkdir eslint-tmp
cd eslint-tmp || exit
npm init --yes
npm install --global-style --no-bin-links --production --no-package-lock eslint@latest
-
- (
- cd node_modules/eslint || exit
-
- npm install --no-bin-links --production --no-package-lock eslint-plugin-markdown@latest
- )
-
+ npm install --global-style --no-bin-links --production --no-package-lock eslint-plugin-markdown@latest
# Use dmn to remove some unneeded files.
npx dmn@2.2.2 -f clean
@@ -31,4 +25,6 @@ rm -rf node_modules/eslint
)
mv eslint-tmp/node_modules/eslint node_modules/eslint
+mv eslint-tmp/node_modules/eslint-plugin-markdown node_modules/eslint-plugin-markdown
+
rm -rf eslint-tmp/
but that means adding a new folder and some dependencies are probably not deduplicated.