deoxxa / npmrc

Switch between different .npmrc files with ease and grace.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could not create .npmrc file on windows

fritx opened this issue · comments

I was on Win10, but once I manually did touch C:\Users\fritx\.npmrc it began to work

$ npm i -g npmrc
$ npmrc -r cn
Initialising npmrc...
Creating C:\Users\fritx\.npmrcs
Activating .npmrc "default"
fs.js:500
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: ENOENT, no such file or directory 'C:\Users\fritx\.npmrc'
    at Error (native)
    at Object.fs.openSync (fs.js:500:18)
    at Object.fs.readFileSync (fs.js:352:15)
    at replaceRegistry (C:\Users\fritx\AppData\Roaming\npm\node_modules\npmrc\npmrc.js:215:21)
    at handleOPtions (C:\Users\fritx\AppData\Roaming\npm\node_modules\npmrc\npmrc.js:190:5)
    at Object.<anonymous> (C:\Users\fritx\AppData\Roaming\npm\node_modules\npmrc\npmrc.js:191:2)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)

@fritx you need to run as administrator

@jhiswin oh yes. you mean run the commandline as admin?

Yes, you will need to remove npmrc and reinstall it as administrator also, and then run it as admin

Thanks! My win10 has gone.. let me try it next time..