npm encountered an issue: EPERM error - the operation is not permitted and cannot unlink the file

  • Operating System: Windows 10.
  • NPM Version: 6.9.0
  • Node Version: 12.4.0

I am currently developing an Expo application. I am attempting to install all the necessary packages for my Expo application using 'npm install'. However, I encountered an error:

17254 error [OperationalError: EPERM: operation not permitted, unlink ...
I have searched for solutions to this error but none seem to address my specific issue.

I have already attempted the following troubleshooting steps:

  1. Running my terminal as an administrator.
  2. Executing 'npm config set safe-perm=true'.
  3. Using 'npm install --no-bin-links' command.
  4. Clearing the npm cache with 'npm cache clear --force'.

Here is an example of the error message I encountered:

17254 error cause: [Error: EPERM: operation not permitted, unlink 'C:\Users\Thomas\Desktop\someDirectory\someDirectory\someDirectory\someDirectory\node_modules\.staging\react-native-99ed309f\Libraries\Renderer\oss\ReactFabric-dev.js'] {
17254 error errno: -4048,
17254 error code: 'EPERM',
17254 error syscall: 'unlink',
17254 error path: 'C:\\Users\\Thomas\\Desktop\\someDirectory\\someDirectory\\someDirectory\\someDirectory\\node_modules\\.staging\\react-native-99ed309f\\Libraries\\Renderer\\oss\\ReactFabric-dev.js'
17254 error },
17254 error stack: 'Error: EPERM: operation not permitted, unlink ' +
17254 error "'C:\\Users\\Thomas\\Desktop\\someDirectory\\someDirectory\\someDirectory\\someDirectory\\node_modules\\.staging\\react-native-99ed309f\\Libraries\\Renderer\\oss\\ReactFabric-dev.js'",
17254 error errno: -4048,
17254 error code: 'EPERM',
17254 error syscall: 'unlink',
17254 error path: 'C:\\Users\\Thomas\\Desktop\\someDirectory\\someDirectory\\someDirectory\\someDirectory\\node_modules\\.staging\\react-native-99ed309f\\Libraries\\Renderer\\oss\\ReactFabric-dev.js'
17254 error }
17255 error The operation was rejected by your operating system.
17255 error It's possible that the file was already in use (by a text editor or antivirus),
17255 error or that you lack permissions to access it.
17255 error
17255 error If you believe this might be a permissions issue, please double-check the
17255 error permissions of the file and its containing directories, or try running
17255 error the command again as root/Administrator (though this is not recommended).
17256 verbose exit [-4048, true] 

Answer №1

Ensure that no other node instance using ReactFabric-dev.js is running before proceeding. If there is, terminate it and try again. Additionally, consider relocating your project to a directory closer to the root folder as Windows can sometimes have issues with excessively long file paths.

Answer №2

Resolved the issue by accessing npmjs through my account: npm login

Alternatively,

You can uninstall all npm modules and reinstall them using npm install --no-bin-links

Another option is to delete the following directories:

rd /s /q C:\Users\foo\AppData\Roaming\npm-cache
rd /s /q C:\Users\foo\AppData\Roaming\npm

Answer №3

Here is the solution I found:

  1. Removed the node_modules directory;

  2. Launched Visual Studio Code with admin privileges;

  3. Executed the following commands in the terminal:

    npm cache clean --force

    npm install

Answer №4

I encountered an error message recently, and in order to resolve it, I followed these steps:

1) Added my project folder to the Windows Defender exclusions list.

2) Deleted the node_modules folder.

3) Executed the following command:

npm install

Answer №5

One method to get started is by installing it globally right away. You can achieve this by running the following command:

  • npm install -g create-react-app

After that, you are all set to create your app using this command:

  • npx create-react-app <Name_of_your_app>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Looking for assistance with transferring a data attribute to a form redirection

I'm seeking assistance with a coding dilemma I've encountered. To provide some background, I have a list of items on my website, each featuring a 'Book Now' button that redirects users to different pages. Recently, I incorporated a mod ...

Guide to using AJAX to send a select tag value to a PHP script on the current page

Issue I am facing a problem where I need to utilize the select tag in order to choose a value and then send that value via an ajax call to a PHP script embedded within the same page. In my code, I have implemented the select tag and upon selecting a valu ...

Adjust the Highcharts semi-pie design by eliminating the gap between the pie and the legend

I'm having trouble adjusting the spacing between the bottom of a semi circle donut chart in Highcharts and the legend below it. Despite my efforts, I have not been successful in reducing this gap. Here is the basic chart I am currently working on: h ...

What is the best way to retrieve all dates that are older than 30 days using JavaScript?

I have the following code snippet as a reference and I'm attempting to retrieve a list of dates from 30 days before. What do I need to change? Date.prototype.addDays = function(days) { var newDate = new Date(this.valueOf()) newDate.s ...

When the Angular script is executed, the variable is not defined

One of my custom directives receives an object named 'vm' in its scope, which contains a property/value pair (ccirCategoryIncidentI : 3) that I need to access. When I try to log this value with console.log(scope.vm.ccirCategoryIncidentI), it init ...

Unscramble the pairs in this React JS two-column puzzle!

I am working on a project that requires me to create pairs of matches/links from two vertical lists. An example pair list could look like this: const [pairs, setPairs] = useState([ { id: 1, left: "Apple", right: "Red" }, { id: ...

How to Stop AJAX Requests Mid-Flight with JQuery's .ajax?

Similar Question: Stopping Ajax Requests in JavaScript with jQuery Below is the straightforward piece of code that I am currently using: $("#friend_search").keyup(function() { if($(this).val().length > 0) { obtainFriendlist($(this).va ...

Preventing commits when encountering build or lint errors

Every git repository contains git hooks within the .git/hooks directory. I have included a npm run lint command in the pre-commit git hook. However, I am unable to prevent the commit if npm run lint returns an error. ...

Enhancing Element Generation and Data Association through jQuery

Currently, I am seeking a more streamlined approach to generate DOM alterations and update the object within .data(). At the moment, data is being supplied in an array of objects. I construct strings piecemeal, appending them to the table body, and affixi ...

Tips for accessing nested JSON values using Selenium

Here is a JSON snippet to work with: "ACCOUNT": { "AmountDue": "$36,812.99", "OutstandingBalance": "$27,142.27", "StatementTotal": "$9,670.72", "StatementDate": "12/6/2018", "DueByDate": "12/23/2018", ...

"Encountered an issue while serializing the user for session storage in Passport.js. Have you already implemented code for

I have recently started learning nodejs and I am currently working on creating a login system. I followed the code for serializing the user from the passport documentation and placed it in config/passport.js. However, I keep encountering the error "Failed ...

Navigating through the Table using AngularJS

I was able to successfully loop through a table using AngularJS to retrieve values from a specified scope named {{rec}} as shown below. HTML <div id="AngularContainer" data-ng-app="myApp" data-ng-controller="myCtrl"> < ...

How to dynamically load a file based on the chosen option value in React

Two select textboxes on my page are named Choose City and Choose District. I also have some files related to cities and districts: // cities.js const cities = { "01": { "name": "City 1", "code": "01" }, ...

What is the method for developing a Typescript-connected High-Order React Component with Redux?

I am looking to develop a React Higher-Order Component that can safeguard routes within my application from unauthorized users without an access token. I aim to use this HOC to wrap a Component like so in the parent component: <Route exact path ...

Typescript Tooltip for eCharts

I'm working on customizing the tooltip in eChart v5.0.2 using Typescript, but I'm encountering an error related to the formatter that I can't seem to resolve. The error message regarding the function keyword is as follows: Type '(param ...

Exploring the world of third-party widgets: Comparing Angular, jQuery, and traditional JavaScript

I have a plan to develop a simple embeddable widget similar to Google ads or Facebook like box. Users will be able to easily add the widget to their website and I will extract some parameters to fetch data from my servers. Previously, I relied on jQuery f ...

Receiving an item in place of a true/false indicator

I wrote an asynchronous function that validates the permission status on a device. Here is the function: checkPermission = async () => { const allowed = await requestNotifications(['alert', 'sound']).then((res) => { if ...

The debate between utilizing CDN or installing a library through NPM

My journey with NPM has just begun, and I am struggling to grasp how the files within node_modules get integrated into my index.html. Scenario 1: CDN Take jQuery, for instance. When using a CDN, it's as simple as adding the CDN link to a <script& ...

The output of the http.get or http.request callback is only visible within the shell when using node.js

Just dipping my toes into node and aiming to avoid falling into the callback hell trap. I'm currently working with two files: routes.js fetch.js //routes.js var fetchController = require("../lib/mtl_fetcher/fetcher_controller"); var express = requir ...

Ways to programmatically append data to an object using JavaScript

My dilemma involves an object: var myObject={}; accompanied by a function that appends values to the object: function appendData(id, name){ //logic to validate id and name format, specify conditions for name being "John" and id being "I23423" my ...