-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
EMFILE error may be thrown during npm install, depending on the allowed file descriptors and the state of the cache before the install. An example error:
Error: EMFILE: too many open files, open '/Users/<user>/.npm/_cacache/index-v5/64/ee/136420e5adf6592619d25b411c7849220f30364ed8ba96dea19887a5d1f2'
Expected Behavior
npm install should succeed.
Steps To Reproduce
- Create a project directory and add package.json with the following:
{
"name": "nuxt-app",
"devDependencies": {
"nuxt": "^3.7.0"
}
}
(The error happens reliably with nuxt, but it's not related to nuxt, you can use other packages and get the same result.)
- Set a low file descriptor limit using
ulimit -Hn 128(It's possible to get the error with a higher ulimit, but using a low value helps to reliably reproduce the error) - Delete the global cacache, eg:
rm -rf /<home-dir>/.npm/_cacache/ - Delete the project's node_modules folder:
rm -rf node_modules - Run
npm install - EMFILE error is thrown
(Reset ulimit using ulimit -Hn unlimited)
Environment
- npm: 10.4.0
- Node: 20.11.0
- OS: MacOS 14.1.2
- platform: Macbook Pro 2019 (Intel)