I had to upgrade node.js to v4+ (now on 4.1.0) and I am having issues now with Bower (1.5.2). I am not 100% sure that the issue started immediately after the upgrade of node.js though. On all of my angular/ionic projects I get "Error: EISDIR: illegal operation on a directory, read" when issuing a "bower install". This is the stacktrace:
Error: EISDIR: illegal operation on a directory, read
at Error (native)
at Object.fs.readSync (fs.js:603:19)
at Object.fs.readSync (C:\Users\mvrm\AppData\Roaming\npm\node_modules\bower\node_modules\bower-config\node_modules\graceful-fs\polyfills.js:218:23)
at Object.fs.readFileSync (fs.js:438:24)
at C:\Users\mvrm\AppData\Roaming\npm\node_modules\bower\node_modules\bower-config\lib\util\rc.js:75:27
at Array.forEach (native)
at json (C:\Users\mvrm\AppData\Roaming\npm\node_modules\bower\node_modules\bower-config\lib\util\rc.js:74:14)
at rc (C:\Users\mvrm\AppData\Roaming\npm\node_modules\bower\node_modules\bower-config\lib\util\rc.js:31:9)
at Config.load (C:\Users\mvrm\AppData\Roaming\npm\node_modules\bower\node_modules\bower-config\lib\Config.js:14:20)
at Function.Config.read (C:\Users\mvrm\AppData\Roaming\npm\node_modules\bower\node_modules\bower-config\lib\Config.js:49:19)
On another computer, with an older version of bower (1.3.2), there is no graceful-fs and there is no issue.
I found a number of posts regarding this issue but the solutions do not work for me.
As I understand the posts well, the issue seems to be that the code is trying to read a directory as a file.
Is there a way to find out which directory is being accessed as a file? (like printing to console in polyfills.js ?) That may lead me to the cause of this issue.
Thanks a lot!
After debugging the bower js code I found the solution. I do not know why, but I had a ".bowerrc" folder in my root folder ("C:\.bowerrc"). The folder was empty. Removing the folder solved the issue!