4
  • OS : Windows 10.
  • npm version : 6.9.0
  • node version : 12.4.0

I'm working on an expo application. I would like to install all the packages on my expo application (npm install). But, an error occured :

17254 error [OperationalError: EPERM: operation not permitted, unlink ... I have seen this error on many subjects, but no one answer to my problem.

I've already tried to :

  1. Launch my terminal as an administrator.
  2. npm config set safe-perm=true.
  3. npm install --no-bin-links
  4. npm cache clear --force

An exemple of error message that I have :

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 ] ```
Thomsath
  • 157
  • 1
  • 3
  • 13
  • The 'Libraries' directory doesn't exists, indeed. But this error also happen on directory that exists, like 'RnTester-js-Tester App.ios', but file inside doesn't. – Thomsath Jun 21 '19 at 09:28
  • There's a bunch of solutions in [this thread](https://stackoverflow.com/questions/46020018/error-eperm-operation-not-permitted-unlink-d-sources-node-modules-fseven) that you could check out. – Jeppe Jun 21 '19 at 09:31
  • cleaning the build folder and rebuilding helped me – Saahithyan Vigneswaran Jun 16 '23 at 06:14

5 Answers5

7

Is there a another instance of node running, that is also using ReactFabric-dev.js? If so, terminate and retry. Also try to move your project to a folder "closer" to root. Windows sometimes gets confused with very long paths.

cveron
  • 71
  • 4
  • There isn't another instance of node that is running on my computer. I restarted it, and nothing change... – Thomsath Jun 21 '19 at 09:28
4

Solved it by logging into npmjs: npm login

or

uninstall all npm modules and re-install with npm install --no-bin-links

or

rd /s /q C:\Users\foo\AppData\Roaming\npm-cache
rd /s /q C:\Users\foo\AppData\Roaming\npm
Umbro
  • 1,984
  • 12
  • 40
  • 99
2

I had this error message, to solve it you have to:

1) add your project folder in Windows Defender exclusions list.

2) remove your node_modules folder

3) run:

npm install
dowpm
  • 31
  • 3
2

What I did is:

  1. Deleted node_modules folder;

  2. Opened VSCode as administrator;

  3. Ran the following commands in terminal:

    npm cache clean --force

    npm install

Farkhod
  • 196
  • 4
  • 8
  • 1
    It might be a bit confusing to require the VSCode terminal. As far as I can see, every terminal that is run as an administrator would do fine. – shaedrich Mar 25 '21 at 10:28
0

Try installing it globally first, using the command

  • npm install -g create-react-app

And then, you can create your app using the command,

  • npx create-react-app <Name_of_your_app>