Skip to content
This repository has been archived by the owner. It is now read-only.

Error: EPERM: operation not permitted, mkdir 'C:\Users\Foo' #100

Open
Meeeeow opened this issue Jul 21, 2017 · 93 comments

Comments

@Meeeeow
Copy link

commented Jul 21, 2017

Environment: Windows 10
npx Version: 9.4.1
See also: #84

Reason:
My user home directory contain whitespace, like foo bar

@zkat zkat added the bug label Jul 22, 2017
@zkat

This comment has been minimized.

Copy link
Owner

commented Jul 22, 2017

@Meeeeow could you post the actual terminal output for this, please? I'm not exactly sure which place it's coming from with just this info.

@Meeeeow

This comment has been minimized.

Copy link
Author

commented Jul 22, 2017

Error: EPERM: operation not permitted, mkdir 'C:\Users\Foo'
TypeError: Cannot read property 'get' of undefined
    at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:213:17)
    at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:83:20
    at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:215:22)
    at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:253:24
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7
    at Array.forEach (native)
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80:13
    at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
    at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:178:20)
    at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:213
  if (npm.config.get('json')) {
                ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:213:17)
    at emitOne (events.js:115:13)
    at process.emit (events.js:210:7)
    at process._fatalException (bootstrap_node.js:329:26)
Install for prefix@latest failed with code 7
Error: EPERM: operation not permitted, mkdir 'C:\Users\Foo'
TypeError: Cannot read property 'get' of undefined
    at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:213:17)
    at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:83:20
    at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:215:22)
    at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:253:24
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7
    at Array.forEach (native)
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80:13
    at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
    at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:178:20)
    at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:213
  if (npm.config.get('json')) {
                ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:213:17)
    at emitOne (events.js:115:13)
    at process.emit (events.js:210:7)
    at process._fatalException (bootstrap_node.js:329:26)
Install for cowsay@latest failed with code 7

@zkat

@zkat

This comment has been minimized.

Copy link
Owner

commented Jul 22, 2017

Thanks! This looks like a bug in npm itself. I'll look into it!

@frenmanoj

This comment has been minimized.

Copy link

commented Sep 26, 2017

I had the similar issue. Got fixed just by cleaning the npm cache.

npm cache clean

@prat1477

This comment has been minimized.

Copy link

commented Oct 16, 2017

Error: EPERM: operation not permitted, mkdir 'C:\Program Files\Java\JDK.ioni
at Error (native)
at Object.fs.mkdirSync (fs.js:924:18)
at new IonicStore (D:\ConCustomer\node_modules\ionic\lib\ionic\store.js:2
)
at Object. (D:\ConCustomer\node_modules\ionic\lib\cli.js:6:19)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)

@prat1477

This comment has been minimized.

Copy link

commented Oct 16, 2017

can anyone tell me how to fix this ????

@jrmcdona

This comment has been minimized.

Copy link

commented Nov 11, 2017

npm clean cache doesn't work. No NPM commands work. They are all result in this same error. Even npm -v

@patnaix

This comment has been minimized.

Copy link

commented Nov 14, 2017

running cmd through administrator works for me

@paulcyr

This comment has been minimized.

Copy link

commented Dec 11, 2017

I noticed that the path in the error message cut off prior to the first space. The path to my user folder is 'C:\Users\Paul Cyr'.

Environment: Windows 10 Build 15063.726

Error: EPERM: operation not permitted, mkdir 'C:\Users\Paul'
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:83:20
    at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:214:22)
    at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:252:24
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7
    at Array.forEach (<anonymous>)
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80:13
    at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
    at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:178:20)
    at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205
  if (npm.config.get('json')) {
                 ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
    at emitOne (events.js:116:13)
    at process.emit (events.js:211:7)
    at process._fatalException (bootstrap_node.js:374:26)
Install for prefix@latest failed with code 7
Error: EPERM: operation not permitted, mkdir 'C:\Users\Paul'
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:83:20
    at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:214:22)
    at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:252:24
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7
    at Array.forEach (<anonymous>)
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80:13
    at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
    at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:178:20)
    at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205
  if (npm.config.get('json')) {
                 ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
    at emitOne (events.js:116:13)
    at process.emit (events.js:211:7)
    at process._fatalException (bootstrap_node.js:374:26)
Install for webpack@latest failed with code 7
@paulcyr

This comment has been minimized.

Copy link

commented Dec 11, 2017

Changing the command from webpack --config webpack.config.js to node_modules\.bin\webpack --config webpack.config.js solved my problem.

@Tokimon

This comment has been minimized.

Copy link

commented Dec 13, 2017

I have the same problem but I have only encountered it with 2 modules so far.
NVM for windows and TSlint.

OS: Windows 10
NPM: 5.6.0

@wolfy1339

This comment has been minimized.

Copy link

commented Dec 15, 2017

I was hit with the same problem, same backtrace, and for the same reason as the OP .
NPM: 5.6.0
Node: 9.2.0
OS: Windows 10 version 1709 (Fall Creators Update)

@ghost

This comment has been minimized.

Copy link

commented Jan 10, 2018

Any update on when the fix for this will be included? It is popping up through more and more modules

@JordanJD

This comment has been minimized.

Copy link

commented Jan 26, 2018

I also have this issue, although it is failing on mkdir of a username with a space in it, that is not on my computer. Is this a config setting I should change (maybe it somehow mixed up user config that I had on an old computer)?

Fixed
Did a search for .npmrc file, and changed prefix= to the correct user.

@DninoAdnane

This comment has been minimized.

Copy link

commented Mar 7, 2018

I think you should excute this command on administrator "npm config set prefix path/to/Actual_npm_folder"

@nullstrike

This comment has been minimized.

Copy link

commented Mar 26, 2018

any news if there ways to resolved the issue regarding user profile paths with spaces.

@chetanbajaj

This comment has been minimized.

Copy link

commented Mar 29, 2018

i m also facing same problem
Error: EPERM: operation not permitted, mkdir 'C:\Users\user'
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:83:20
at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:224:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:262:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7
at Array.forEach ()
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80:13
at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:178:20)
at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:35:29
at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:35:29
at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:35:29
at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53
at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
at FSReqWrap.oncomplete (fs.js:152:21)
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205
if (npm.config.get('json')) {
^

TypeError: Cannot read property 'get' of undefined
at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
at emitOne (events.js:116:13)
at process.emit (events.js:211:7)
at process._fatalException (bootstrap_node.js:375:26)
Error: EPERM: operation not permitted, mkdir 'C:\Users\user'
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:83:20
at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:224:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:262:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7
at Array.forEach ()
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80:13
at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:178:20)
at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:35:29
at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:35:29
at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:35:29
at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53
at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
at FSReqWrap.oncomplete (fs.js:152:21)
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205
if (npm.config.get('json')) {
^

TypeError: Cannot read property 'get' of undefined
at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
at emitOne (events.js:116:13)
at process.emit (events.js:211:7)
at process._fatalException (bootstrap_node.js:375:26)

not any single npm command work

@Tokimon

This comment has been minimized.

Copy link

commented Apr 9, 2018

I'm still having the problem. Now with TypeScript as well. Exactly the same error as the ones above.

@eyalewin

This comment has been minimized.

Copy link

commented Apr 17, 2018

Jumping in..
Same issue here

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:83:20 at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:224:22) at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:262:24 at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7 at Array.forEach (<anonymous>) at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80: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:194:14) at Conf.afterCARead (C:\Program Files\nodejs\node_modules\npm\lib\config\load-cafile.js:14:14) at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:495:12)

@ajsaulsberry

This comment has been minimized.

Copy link

commented Apr 23, 2018

Seeing the same behavior here with respect to paths with spaces. Appears to be limited to npx.
npm cache verify has no effect.

Output as follows for directory C:\Users\Foo G. Bar

Error: EPERM: operation not permitted, mkdir 'C:\Users\Foo' 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:83:20 at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:224:22) at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:262:24 at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7 at Array.forEach (<anonymous>) at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80:13 at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25) at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:178:20) at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53 at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29 at FSReqWrap.oncomplete (fs.js:152:21)

@thw0rted

This comment has been minimized.

Copy link

commented Apr 24, 2018

Am I reading this right, that there's a fix (#138) but until it gets merged, npx doesn't work on Windows (if my profile dir has a space in it)? Bummer, I just found out about npx today and got all excited to stop typing ./node_modules/.bin so much...

@abd3

This comment has been minimized.

Copy link

commented Apr 26, 2018

I have the same issue, but I'm on a Mac and I have no spaces in my home directory. Node is installed in /usr/local/....

Note that this problem goes away if I install using sudo

NPM Version 5.6
Tried on Nodes version 8.11 and 10.0

@chaturanga836

This comment has been minimized.

Copy link

commented Mar 6, 2019

@manojkumardesai Thank you

npm install -g create-react-app
npx create-react-app

works

This work for me too

@aymenjegham

This comment has been minimized.

Copy link

commented Mar 11, 2019

CMD as administrator solved it for me

@dv-here

This comment has been minimized.

Copy link

commented Mar 12, 2019

I think i set the "npm config set prefix= to something" mistakenly due to which i was getting the error. Here's how i fixed it:
Open CMD in "Administrator" mode.
npm cache clear --force
npm install
npm config set cache C:\Users\myname\AppData\Roaming\npm-cache
npm config set prefix C:\Users\myname\AppData\Roaming\npm

Happy coding.

@jemckaleman

This comment has been minimized.

Copy link

commented Mar 26, 2019

Heres is my solution:
npm install -g create-react-app
npx create-react-app my-app
cd my-app
npm start
the only thing i think about is making sure npx is up to date.

@001101

This comment has been minimized.

Copy link

commented Mar 27, 2019

It's a escape error, this escape for / path works for me: "\/"

platform is win10

@jescowuester

This comment has been minimized.

Copy link

commented Mar 29, 2019

I tried everything in this thread and nothing worked, then I installed Cmder and it magically worked...

@ptolbert

This comment has been minimized.

Copy link

commented Apr 3, 2019

Try going to the file .npmrc, in "C:\Users%UserName%", and deleting it.

@basseur

This comment has been minimized.

Copy link

commented Apr 11, 2019

I found these solutions, which worked for me!

#146 (comment)

#146 (comment)

You need to change the cache to a location without spaces.

@IshuKanda

This comment has been minimized.

Copy link

commented Apr 14, 2019

I was also facing the same problem while following react tutorials. Following steps worked for me
I changed all the defaults path of node and npm from C:\Users\ {user name} to some other drive.

  1. Installed the node to some other drive.
  2. Moved npm to some other location(say D:\npm)
  3. Changed the paths of npm from PATH env variable
  4. Changed the paths of npm-cache, .global_variables, .npmrc to (D:\npm) using npm config set {command} = {path}
    This will override the existing settings and set the new ones.

After this I ran the npx command shown in tutorial, and it worked.

Hope this helps.

@michelcve

This comment has been minimized.

Copy link

commented Apr 17, 2019

Workarounds aside, is there any chance this gets fixed? The issue is quite old, but the issue still remains.

@carolinamaciel1

This comment has been minimized.

Copy link

commented Apr 17, 2019

image

My user name was "C:\Users\Carolina Maciel" i used:

1º)cmd /c mklink /J "C:\Users\myname" "C:\Users\My Name"
2º) npm config set cache C:\Users\myname\AppData\Roaming\npm-cache
3º) npm config set prefix C:\Users\myname\AppData\Roaming\npm

if not work, use:
npm cache clean --force

Worked for me, hope helps for u!

@michelcve

This comment has been minimized.

Copy link

commented Apr 18, 2019

@carolinamaciel1 Thanks, but as I said, this is a workaround.

There is a PR request readily available, which only needs to be merged to REALLY fix this problem.

@zkat My hope is on you ;-) Any change you could merge PR #181 ?

@sathish-spidie

This comment has been minimized.

Copy link

commented Apr 18, 2019

I was able to fix this in Windows by creating a directory junction to my users folder that didn't have a space in it. You can run a command like this in an administrative powershell:

cmd /c mklink /J "C:\Users\myname" "C:\Users\My Name"

You can then use this junction as if it were your real user directory:

npm config set cache C:\Users\myname\AppData\Roaming\npm-cache
npm config set prefix C:\Users\myname\AppData\Roaming\npm

(the above should update your user .npmrc file)

Life Saver.. Love you man

I'm searching for like an hour and finally, you made it nicely, thank you so much

@rizalamhadi

This comment has been minimized.

Copy link

commented Apr 20, 2019

Seeing the same behavior here with respect to paths with spaces. Appears to be limited to npx.
npm cache verify has no effect.

Output as follows for directory C:\Users\Foo G. Bar

Error: EPERM: operation not permitted, mkdir 'C:\Users\Foo' 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:83:20 at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:224:22) at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:262:24 at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7 at Array.forEach (<anonymous>) at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80:13 at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25) at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:178:20) at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53 at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29 at FSReqWrap.oncomplete (fs.js:152:21)

Error: EPERM: operation not permitted, mkdir 'C:\Users\Foo'
TypeError: Cannot read property 'get' of undefined
    at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:213:17)
    at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:83:20
    at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:215:22)
    at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:253:24
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7
    at Array.forEach (native)
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80:13
    at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
    at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:178:20)
    at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:213
  if (npm.config.get('json')) {
                ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:213:17)
    at emitOne (events.js:115:13)
    at process.emit (events.js:210:7)
    at process._fatalException (bootstrap_node.js:329:26)
Install for prefix@latest failed with code 7
Error: EPERM: operation not permitted, mkdir 'C:\Users\Foo'
TypeError: Cannot read property 'get' of undefined
    at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:213:17)
    at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:83:20
    at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:215:22)
    at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:253:24
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7
    at Array.forEach (native)
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80:13
    at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
    at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:178:20)
    at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:213
  if (npm.config.get('json')) {
                ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:213:17)
    at emitOne (events.js:115:13)
    at process.emit (events.js:210:7)
    at process._fatalException (bootstrap_node.js:329:26)
Install for cowsay@latest failed with code 7

@zkat

run cmd in administrator then npm cache clear --force

@stvenyin

This comment has been minimized.

Copy link

commented Apr 25, 2019

npm cache verify
npm cache clean --force

i'm have a try!!

@kvaezo

This comment has been minimized.

Copy link

commented Apr 28, 2019

Heres is my solution:
npm install -g create-react-app
npx create-react-app my-app
cd my-app
npm start
the only thing i think about is making sure npx is up to date.

This worked for me as well (still having space in my username on Windows 10)

@lewismoten

This comment has been minimized.

Copy link

commented Apr 30, 2019

Moo

PS C:\dev> npx cowsay hi
Error: EPERM: operation not permitted, mkdir 'C:\Users\Lewis'
TypeError: Cannot read property 'loaded' of undefined
    at exit (C:\Users\Lewis Moten\AppData\Roaming\npm\node_modules\npm\lib\utils\error-handler.js:98:27)
    at errorHandler (C:\Users\Lewis Moten\AppData\Roaming\npm\node_modules\npm\lib\utils\error-handler.js:216:3)
    at C:\Users\Lewis Moten\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:77:20
    at cb (C:\Users\Lewis Moten\AppData\Roaming\npm\node_modules\npm\lib\npm.js:225:22)
    at C:\Users\Lewis Moten\AppData\Roaming\npm\node_modules\npm\lib\npm.js:263:24
    at C:\Users\Lewis Moten\AppData\Roaming\npm\node_modules\npm\lib\config\core.js:83:7
    at Array.forEach (<anonymous>)
    at C:\Users\Lewis Moten\AppData\Roaming\npm\node_modules\npm\lib\config\core.js:82:13
    at f (C:\Users\Lewis Moten\AppData\Roaming\npm\node_modules\npm\node_modules\once\once.js:25:25)
    at afterExtras (C:\Users\Lewis Moten\AppData\Roaming\npm\node_modules\npm\lib\config\core.js:173:20)
C:\Users\Lewis Moten\AppData\Roaming\npm\node_modules\npm\lib\utils\error-handler.js:98
  var doExit = npm.config.loaded ? npm.config.get('_exit') : true
                          ^

TypeError: Cannot read property 'loaded' of undefined
    at exit (C:\Users\Lewis Moten\AppData\Roaming\npm\node_modules\npm\lib\utils\error-handler.js:98:27)
    at process.errorHandler (C:\Users\Lewis Moten\AppData\Roaming\npm\node_modules\npm\lib\utils\error-handler.js:216:3)
    at process.emit (events.js:189:13)
    at process._fatalException (internal/bootstrap/node.js:496:27)
Install for cowsay@latest failed with code 7
PS C:\dev> npx -v; npm -v; node -v
6.9.0
6.9.0
v10.15.3
PS C:\dev> npm i cowsay -g
C:\Users\Lewis Moten\AppData\Roaming\npm\cowsay -> C:\Users\Lewis Moten\AppData\Roaming\npm\node_modules\cowsay\cli.js
C:\Users\Lewis Moten\AppData\Roaming\npm\cowthink -> C:\Users\Lewis Moten\AppData\Roaming\npm\node_modules\cowsay\cli.js
+ cowsay@1.4.0
added 10 packages from 3 contributors in 1.596s
PS C:\dev> npx cowsay hi
 ____
< hi >
 ----
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
PS C:\dev>
@solancer

This comment has been minimized.

Copy link

commented May 8, 2019

image

Same issue

@mikepascual

This comment has been minimized.

Copy link

commented May 9, 2019

It's a escape error, this escape for / path works for me: "\/"

platform is win10

Escaping the slash this way worked for me. Thank you very much. I'm also on windows 10. I do not have a space in my user name.

This problem started for me after calling this:
npm config -g set cafile

After the above I tried calling this and then I saw the error:

npm config -g set cafile C:\Users\XXXXXXXX\git-certs\cert_XXXXXXXX.pem
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 (<anonymous>)
    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')) {
                 ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
    at process.emit (events.js:189:13)
    at process._fatalException (internal/bootstrap/node.js:496:27)
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 (<anonymous>)
    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')) {
                 ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
    at process.emit (events.js:189:13)
    at process._fatalException (internal/bootstrap/node.js:496:27)

This line in my .npmrc file fixed it for me:
cafile="C:\/Users\/XXXXXXXXX\/git-certs\/cert_XXXXXXX.pem"

@satheeskumar-s

This comment has been minimized.

@luizmagao

This comment has been minimized.

Copy link

commented Jun 19, 2019

@manojkumardesai Thank you
npm install -g create-react-app
npx create-react-app
works

This work for me too

Resolvido com esse código.

@JoFont

This comment has been minimized.

Copy link

commented Jun 28, 2019

I found these solutions, which worked for me!

#146 (comment)

#146 (comment)

You need to change the cache to a location without spaces.

Thank you my lord! Saved a day of headaches!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
You can’t perform that action at this time.