# EPERM: operation not permitted, \[NodeJs\] \[Electron\]

**URL:** https://travis-ci.community/t/eperm-operation-not-permitted-nodejs-electron/2571
**Category:** Windows
**Created:** [March 7, 2019, 10:14am UTC](https://travis-ci.community/t/eperm-operation-not-permitted-nodejs-electron/2571 "2019-03-07T10:14:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![joshuef](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/joshuef/32/190_2.png) [@joshuef](https://travis-ci.community/u/joshuef)
#### Post date: [March 7, 2019, 10:14am UTC](https://travis-ci.community/t/eperm-operation-not-permitted-nodejs-electron/2571/1 "2019-03-07T10:14:00Z")

</div>

I’m seeing this issue pretty consistently now on our attempted windows builds (for some reason occasionally it’s not an issue… but more often than not it is):

```auto
Error deleting cache file: EPERM: operation not permitted, unlink 'C:\Users\travis\AppData\Local\electron\Cache'
{ Error: EPERM: operation not permitted, rename 'C:\Users\travis\AppData\Local\electron\Cache\tmp-2284-3-system_uri-v0.4.0-win-x64.zip' -> 'C:\Users\travis\AppData\Local\electron\Cache\system_uri-v0.4.0-win-x64.zip'
  errno: -4048,
  code: 'EPERM',
  syscall: 'rename',
  path: 'C:\\Users\\travis\\AppData\\Local\\electron\\Cache\\tmp-2284-3-system_uri-v0.4.0-win-x64.zip',
  dest: 'C:\\Users\\travis\\AppData\\Local\\electron\\Cache\\system_uri-v0.4.0-win-x64.zip' }
C:\Users\travis\build\joshuef\safe_browser\node_modules\@maidsafe\safe-node-app\node_modules\deps_downloader\index.js:10
		throw err
		^

```

Having read around, it seems like it’s a common-ish issue for npm installs on windows when an antivirus or some other program may be trying to access files: [https://github.com/npm/npm/issues/12059](https://github.com/npm/npm/issues/12059) sadly the suggested solution there is to use npm 6, which we’re already doing.

I’ve tried some suggestions I’ve read such as:

- Increasing yarn network timeout: `yarn --ignore-engines --network-timeout 700000`  
-verifying cache: `- npm cache verify`
- adjusting cache lock `npm config set cache-lock-retries 15` (also tried at 100/500)

To no avail ☹

Anyone come up agains / conquered this? Any further ideas on how to avoid permission issues on install on windows?

Thanks!

---

<div class="post-metadata">

### Author: ![bkimminich](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/bkimminich/32/2114_2.png) [@bkimminich](https://travis-ci.community/u/bkimminich)
#### Post date: [June 28, 2019, 2:54pm UTC](https://travis-ci.community/t/eperm-operation-not-permitted-nodejs-electron/2571/2 "2019-06-28T14:54:14Z")

</div>

My Windows builds run into the same error occasionally, one example can be found [in full here](https://travis-ci.org/bkimminich/juice-shop/jobs/551785833) and its error log also below:

```auto
npm ERR! path C:\Users\travis\build\bkimminich\juice-shop\frontend\node_modules\.staging\typescript-685a7086\lib\typescriptServices.js
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\travis\build\bkimminich\juice-shop\frontend\node_modules\.staging\typescript-685a7086\lib\typescriptServices.js'
npm ERR! [OperationalError: EPERM: operation not permitted, unlink 'C:\Users\travis\build\bkimminich\juice-shop\frontend\node_modules\.staging\typescript-685a7086\lib\typescriptServices.js'] {
npm ERR! cause: [Error: EPERM: operation not permitted, unlink 'C:\Users\travis\build\bkimminich\juice-shop\frontend\node_modules\.staging\typescript-685a7086\lib\typescriptServices.js'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\travis\\build\\bkimminich\\juice-shop\\frontend\\node_modules\\.staging\\typescript-685a7086\\lib\\typescriptServices.js'
npm ERR! },
npm ERR! stack: "Error: EPERM: operation not permitted, unlink 'C:\\Users\\travis\\build\\bkimminich\\juice-shop\\frontend\\node_modules\\.staging\\typescript-685a7086\\lib\\typescriptServices.js'",
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\travis\\build\\bkimminich\\juice-shop\\frontend\\node_modules\\.staging\\typescript-685a7086\\lib\\typescriptServices.js',
npm ERR! parent: '@angular-devkit/build-optimizer'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

```

With “occasionally” I mean "not always but so often that I set

```auto
matrix:
  fast_finish: true
  allow_failures:
    - os: windows

```

to avoid having to manually restart builds all the time"… 😑

---

<div class="post-metadata">

### Author: ![tanzislam](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/tanzislam/32/2591_2.png) [@tanzislam](https://travis-ci.community/u/tanzislam)
#### Post date: [January 6, 2020, 5:33am UTC](https://travis-ci.community/t/eperm-operation-not-permitted-nodejs-electron/2571/3 "2020-01-06T05:33:21Z")

</div>

This should be fixed now that [Windows Defender has been disabled](https://travis-ci.community/t/windows-builds-time-out-during-cache-restore/4642/7).
