2

I'm trying to run a gulp script. But I'm getting this permission related error.

fs.js:584
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: EPERM: operation not permitted, open 'd:\CODE\project\node_modules\ttf2woff2\jssrc\ttf2woff2.js'
    at Error (native)
    at Object.fs.openSync (fs.js:584:18)
    at Object.fs.readFileSync (fs.js:431:33)
    at Object.Module._extensions..js (module.js:421:20)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (d:\CODE\project\node_modules\ttf2woff2\jssrc\index.js:3:27)
    at Module._compile (module.js:413:34)

My OS: Windows 10

Node version: v5.9.1

I've set the permissions of project folder to read/write for all users recursively via folder security in windows and i've tried running the gulp task as admin.

More info

When I try to open ttf2woff2\jssrc\ttf2woff2.js in notepad as administrator I get: You don't have permission to open this file, contact the file owner or an administrator to obtain permission.

  • I have taken full ownership of the file
  • I have created a permission rule for Everyone with full access
  • I've tried copying the file via cmd as administrator to another directory but get access denied.
  • I've tried downloading the file direct from github via chrome instead of via npm and still cannot open it.
  • I've disabled UAC
  • I've tried viewing the raw code on git and copying it into a file I've created. This just gives me a javascript error when running the gulp task, I suspect that it's how displaying all the code due to its side, the indentation leaves me thinking it's cutting off at 44k lines.

Still cannot get into it.

enter image description here

Kiee
  • 10,661
  • 8
  • 31
  • 56

1 Answers1

0

Kiee, I had exactly the same problem. We could troubleshoot this in more ways that you want to try. However, I like the clean slate approach when all else fails. Get yourself the node tool "rimraf".

npm install rimraf

run rimraf on the node_modules folder

rimraf "C:\...\node_modules"

Reboot your system if possible.

install all your node packages

npm install

What could be happening?

Any number of things up to and including the folder/file not existing and Windows explorer not recognizing that fact. Yes, that happened.

Wilmer SH
  • 1,417
  • 12
  • 20
  • This is absolutely not an answer to the question : OC question regards windows permission loosing, while this answer only provides a remove tool for npm. – Riduidel Aug 24 '17 at 15:36
  • @Riduidel, I beg to differ. Please refer to [this SO question](https://stackoverflow.com/questions/28175200/unable-to-delete-node-modules-folder-windows-7). This is the very reason why I came across **rimraf** in the first place. It's not a matter of opinion. It's a matter of fact. You can do the exercise in Windows 7. – Wilmer SH Aug 24 '17 at 18:30