npm install Failed: ENOENT, EPERM rmdir, EBADF Errors While Creating SPFx Solution

Recently, while I was trying to create a new SPFx (SharePoint Framework) solution using the yo @microsoft/sharepoint command, the process failed and displayed more than 100 npm warnings. Then, at last, it displays some errors like:

EPERM: operation not permitted, rmdir '…\node_modules\@rushstack…'

EBADF: bad file descriptor, write

“failed to remove directories”

Recent .bin files or .ps1 scripts are missing.
npm WARN enoent ENOENT no such file or director

I couldn’t find any clear solution because these errors do not directly say what the actual root cause was, until I figured it out after researching.

Problem: npm ERR! enoent ENOENT: no such file or directory, open ‘node_modules.bin\parser.ps1’

When running the npm install as a part of the yo @microsoft/sharepoint [SPFx solution scaffolding], you may see thousands of warnings followed by errors like below:

  • EPERM – permission denied
  • ENOENT – No such file or directory
  • EBADF – bad file descriptor

We might think these errors are related to Node.js or npm permission issues, but they can also occur due to our C: or D: drives running out of space. In the image below, you can see that my D drive is out of space.

npm ERR! enoent ENOENT no such file or directory, open 'node_modules.bin parser.ps1'”

Solution

Free up the space on the drive where you’re trying to create a solution. Then try to create a new SPFx solution; this time, you won’t get these types of issues. As shown in the image below, I have freed up my space, and the solution was created successfully.

SPFX React npm WARN tar ENOENT no such file or directory

In this tutorial, I explained how to fix the error “npm install Failed: ENOENT, EPERM rmdir, EBADF Errors” while creating SPFx solutions. The issue is caused by a lack of space in our local system while creating the SPFx solution. Do let me know in the comment below if this helps.

You may also like the following tutorials:

Power Apps functions free pdf

30 Power Apps Functions

This free guide walks you through the 30 most-used Power Apps functions with real business examples, exact syntax, and results you can see.

Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App