5
votes

npm installation broke after setting a config parameter:

i.e. I set the cafile parameter of npm config, now every npm command returns this error:

Error: EISDIR: illegal operation on a directory, read
TypeError: Cannot read property 'get' of undefined
at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:78:20
at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:228:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:266:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach ()
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82:13
at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
at finalize (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:189:14)
at Conf.afterCARead (C:\Program Files\nodejs\node_modules\npm\lib\config\load-cafile.js:14:14)
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205
if (npm.config.get('json')) {
^

it seems like I've broken the npm configuration by doing npm config set cafile ""

2

2 Answers

7
votes

Delete the file /Users/username/.npmrc.

I reinstalled node multiple times with and without nvm but this is the only thing that fixed the permissions issue.

3
votes

The solution is to edit the npm config file manualy. On Windows they are located here:

userconfig :

C:\Users\myuser\.npmrc

globalconfig :

C:\Users\myuser\AppData\Roaming\npm\etc\npmrc