npx
npx copied to clipboard
Error: EPERM: operation not permitted, mkdir 'C:\Users\Foo'
Environment: Windows 10 npx Version: 9.4.1 See also: #84
Reason:
My user home directory contain whitespace, like foo bar
@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.
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
Thanks! This looks like a bug in npm itself. I'll look into it!
I had the similar issue. Got fixed just by cleaning the npm cache.
npm cache clean
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.
can anyone tell me how to fix this ????
npm clean cache doesn't work. No NPM commands work. They are all result in this same error. Even npm -v
running cmd through administrator works for me
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
Changing the command from webpack --config webpack.config.js
to node_modules\.bin\webpack --config webpack.config.js
solved my problem.
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
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)
Any update on when the fix for this will be included? It is popping up through more and more modules
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.
I think you should excute this command on administrator "npm config set prefix path/to/Actual_npm_folder"
any news if there ways to resolved the issue regarding user profile paths with spaces.
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 (
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 (
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
I'm still having the problem. Now with TypeScript as well. Exactly the same error as the ones above.
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)
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)
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...
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
Hi I got the same issue following solved mine npm install -g create-react-app then npm create-react-app (your-app-name)
@falakejaz Do you mean npx create-react-app
? npm create-react-app
won't work
I have similar issue, however it is only happening when I try to run my website in IIS (10.0) Operating System: Windows 10 (10.0.15063) Running through Visual Studio 2017 Enterprise (15.6.7). And here is the stack trace:
Microsoft.AspNetCore.SpaServices:Error:
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)
Error: EPERM: operation not permitted, mkdir
'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm'
I am not sure if this will affect this issue but I am using Angular (5.2.8) with .NET Core 2.0 website.
It works fine for IIS Express but as soon as I try to use it with IIS it fails.
Kind Regards Lukasz
I think it is related to being admin, some how. For instance I just tried to install and if you check Building
section it says;
//if use Windows:
npm config set prefix "C:/Program Files/nodejs/npm_global"
npm config set cache "C:/Program Files/nodejs/npm_cache"
I could set prefix but when I entered cache it gave the the typical error which everyone had above.
But when @patnaix said "running cmd through administrator works for me" , I opened Powershell as administrator and runned npc cache clean
first. Then ran the commands above and done it without getting any error.
I hope it helps.
Removing npmrc worked for me
@Sampana worked for me as well.
@legendarynacar I tried changing npm cache location, no error, but still does not for (the npx)
@Sampana removing npmrc doesnt seem to work too
find the NPMRC file located in C:\Users\ . oped this file in text editor and remove what ever is written there like "prefix=C:/Program Files/nodejs/npm_global" and save again . now run NPM command it will work :)