[BUG] npm install gets stuck on 'idealTree:lib: sill idealTree buildDeps'
Problem
Is there an existing issue for this? - [X] I have searched the existing issues This issue exists in the latest npm version - [X] I am using the latest npm Current Behavior When I run `npm install` in some repository, like https://github.com/mozilla/pdf.js, it gets stuck at the step: 'idealTree:lib: sill idealTree buildDeps'. Other things like `npm -g install` don't work either. Below is the verbose output and debug log attached. npm-verbose.txt 2022-01-21T23_07_33_102Z-debug-0.log Expected Behavior It should install the neccesary packages Steps To Reproduce 1. run `npm install -g gulp-cli` (or any other package presumably) Environment - npm: 8.3.2 - Node.js: v17.3.0 - OS Name: Arch Linux - System Model Name: Hp Zbook studio G5 - npm config: [code block]
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Fix npm install hanging on idealTree buildDeps
The issue occurs due to npm's dependency resolution process getting stuck, often caused by circular dependencies or conflicts in the package versions. This can be exacerbated by network issues or corrupted cache.
Awaiting Verification
Be the first to verify this fix
- 1
Clear npm cache
Clear the npm cache to remove any corrupted files that might be causing the install process to hang.
bashnpm cache clean --force - 2
Check for circular dependencies
Inspect the package.json file for any circular dependencies that may be causing the installation to hang. You can use tools like 'madge' to analyze dependencies.
bashnpx madge --circular . - 3
Update Node.js and npm
Ensure that you are using the latest stable versions of Node.js and npm, as bugs in older versions may have been fixed in updates.
bashnvm install --lts && npm install -g npm@latest - 4
Use legacy peer dependencies
If the issue persists, try installing with the legacy peer dependencies option, which can help resolve conflicts in package versions.
bashnpm install --legacy-peer-deps - 5
Check network connectivity
Ensure that your network connection is stable and that there are no firewall or proxy issues that could be affecting npm's ability to fetch packages.
bashping registry.npmjs.org
Validation
Run 'npm install' again after completing the steps. If the installation completes successfully without hanging, the fix worked. Additionally, check for any error messages in the console output.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep