Home  >  Article  >  Web Front-end  >  How to Fix "EPERM: operation not permitted" Error When Using npm on Windows?

How to Fix "EPERM: operation not permitted" Error When Using npm on Windows?

Barbara Streisand
Barbara StreisandOriginal
2024-11-06 09:37:02931browse

How to Fix

Solving "EPERM: operation not permitted" Error on Windows with npm

When attempting to execute npm commands in a Windows environment, users may encounter the following error:

Error: EPERM: operation not permitted, mkdir 'C:\Program Files (x86)\Git\local'

This issue arises after running the following command:

npm config set prefix /usr/local

The problem lies in setting the prefix path to /usr/local, which is not valid for Windows. This action modifies the prefix variable in the directory C:Program Files (x86)Gitlocal.

To resolve this issue, follow these steps:

  1. Run the command prompt as an administrator.
  2. Execute the command npm config edit to open the configuration file in Notepad.
  3. Locate the prefix variable and change its value to C:UsersAppDataRoamingnpm.

Once these changes are made, you should be able to execute npm commands successfully in a regular console.

The above is the detailed content of How to Fix "EPERM: operation not permitted" Error When Using npm on Windows?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn