Code Monkey home page Code Monkey logo

Comments (93)

edwardbrowncross avatar edwardbrowncross commented on May 22, 2024 59

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)

from npx.

frenmanoj avatar frenmanoj commented on May 22, 2024 51

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

npm cache clean

from npx.

patnaix avatar patnaix commented on May 22, 2024 41

running cmd through administrator works for me

from npx.

manojkumardesai avatar manojkumardesai commented on May 22, 2024 23

If anybody still have this issue. I got it resolved using npm install -g create-react-app and then npx create-react-app <appname>

Make sure your appname doesn't have any capital letters.

from npx.

peterrogov avatar peterrogov commented on May 22, 2024 20

The @manojkumardesai solution has worked for me just fine.

npm install -g create-react-app
npx create-react-app <app-name>

from npx.

varundosapati avatar varundosapati commented on May 22, 2024 11

@manojkumardesai thanks for sharing

Below steps worked for me

npm install -g create-react-app
npx create-react-app <appname>

from npx.

jrmcdona avatar jrmcdona commented on May 22, 2024 9

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

from npx.

DninoAdnane avatar DninoAdnane commented on May 22, 2024 9

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

from npx.

carolinamaciel1 avatar carolinamaciel1 commented on May 22, 2024 9

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!

from npx.

JordanJD avatar JordanJD commented on May 22, 2024 8

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.

from npx.

 avatar commented on May 22, 2024 8

Removing npmrc worked for me

from npx.

dv-here avatar dv-here commented on May 22, 2024 7

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.

from npx.

jemckaleman avatar jemckaleman commented on May 22, 2024 7

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.

from npx.

AvailCat avatar AvailCat commented on May 22, 2024 5
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

from npx.

1kewin1 avatar 1kewin1 commented on May 22, 2024 4

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 :)

from npx.

frijolmasters avatar frijolmasters commented on May 22, 2024 4

@manojkumardesai Thank you

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

works

from npx.

Anthony-Zou avatar Anthony-Zou commented on May 22, 2024 3

If you are looking into this problem with using Microsoft Visual Studio, Run Microsoft Visual Studio as Administrator and the problem will be solved.

from npx.

thw0rted avatar thw0rted commented on May 22, 2024 3

I think npx is working for me now, though it always says

npx: installed 1 in 1.784s
command not found: prefix

before printing the command output. Anyway, none of the "fixes" posted before the one @edwardbrowncross wrote worked for me. I believe that a bunch of people in this thread actually have a totally unrelated problem with a similar stack trace. The actual issue (spaces in your Windows profile directory path) is supposed to be resolved by #181, though I have no idea why that hasn't been merged yet.

In the interim, if you have this issue, you can fix it without administrative privileges. On my machine, I only have to specify cache in my .npmrc, not prefix, and I set it to c:\Users\jamesb~1\AppData\Roaming\npm-cache. Note that jamesb~1 -- that's the generated 8.3 filename (for DOS compatibility) that matches my actual user profile dir. You can view these short names with dir /x, if need be.

from npx.

someoneNameGrey avatar someoneNameGrey commented on May 22, 2024 3

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

from npx.

keir avatar keir commented on May 22, 2024 3

Consider the following flow:

  1. A new user on Windows 10 decides to try out Node + React.
  2. They install Node 10.15.1 LTS from the main site .
  3. They try running npx create-react-app my-app; it fails with the mentioned EPERM error.
  4. They try running npm init react-app my-app, alternate command mentioned on React site; same error.
  5. The user spends 30 minutes tracking down this issue in GitHub.

All Windows users with a space in their filename will encounter this issue. It looks like there was some movement at #181 , but then the work tailed off and wasn't merged. Perhaps if the proper fix can't get completed anytime soon, a more informative message could get printed when the problem is detected.

from npx.

chaturanga836 avatar chaturanga836 commented on May 22, 2024 3

@manojkumardesai Thank you

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

works

This work for me too

from npx.

paulcyr avatar paulcyr commented on May 22, 2024 2

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

from npx.

thw0rted avatar thw0rted commented on May 22, 2024 2

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...

from npx.

zsoltpuskas avatar zsoltpuskas commented on May 22, 2024 2

I can confirm that @edwardbrowncross 's method works. Thanks!

from npx.

sudip1072 avatar sudip1072 commented on May 22, 2024 2

if you have node version less than 10 but greater than 8.10 installed on your system.Then follow below method
First install create-react-app ->
npm install -g create-react-app
Then using npx write following command on command prompt or bash->
npx create-react-app

Else pls upgrade your node version to 10 and use following command only to create a react app
npx create-react-app

Cheer up

from npx.

michelcve avatar michelcve commented on May 22, 2024 2

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

from npx.

 avatar commented on May 22, 2024 1

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

from npx.

legodude17 avatar legodude17 commented on May 22, 2024 1

@falakejaz Do you mean npx create-react-app? npm create-react-app won't work

from npx.

jacksparrow619 avatar jacksparrow619 commented on May 22, 2024 1

@manojkumardesai : fix your spelling of 'create' as asked by @pasunmaa

from npx.

Davidster avatar Davidster commented on May 22, 2024 1

thanks @manojkumardesai !! worked for me

from npx.

Tokimon avatar Tokimon commented on May 22, 2024 1

I still have this problem (just tried with react-styleguidist). I have tried previous suggestions but to no avail:

  • I tried removing my .npmrc (C:\Users\Toke Voltelen\.npmrc)
  • I tried adding prefix=C:\Users\Toke Voltelen to the .npmrc
  • I have cleared npm cache (npm cache clean --force)

I am not sure what else to try at the moment.

NPM Version : 6.2.0
OS: Windows 10 Home 64 bit

from npx.

vicfabrice avatar vicfabrice commented on May 22, 2024 1

So I just solved the problem BUT I took the longest and most stupid path so, please, don't do it: I've changed my Windows username (without spaces this time, of course) -> changed user name folder (without spaces) -> had to waste like 4 hours manually cleaning the registry (regedit -> find "old username" -> change it -> f3 to see next). So now npx works for me.
@hdwebpros Yes I did, but it didn't work.

from npx.

piyarulps avatar piyarulps commented on May 22, 2024 1

This is work for me,I got it resolved using npm install -g create-react-app and create project npx create-react-app myapp

from npx.

001101 avatar 001101 commented on May 22, 2024 1

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

platform is win10

from npx.

jpgoelz avatar jpgoelz commented on May 22, 2024 1

I found these solutions, which worked for me!

#146 (comment)

#146 (comment)

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

from npx.

stvenyin avatar stvenyin commented on May 22, 2024 1

npm cache verify
npm cache clean --force

i'm have a try!!

from npx.

kvaezo avatar kvaezo commented on May 22, 2024 1

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)

from npx.

zkat avatar zkat commented on May 22, 2024

@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.

from npx.

zkat avatar zkat commented on May 22, 2024

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

from npx.

prat1477 avatar prat1477 commented on May 22, 2024

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)

from npx.

prat1477 avatar prat1477 commented on May 22, 2024

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

from npx.

paulcyr avatar paulcyr commented on May 22, 2024

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

from npx.

Tokimon avatar Tokimon commented on May 22, 2024

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

from npx.

wolfy1339 avatar wolfy1339 commented on May 22, 2024

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)

from npx.

nullstrike avatar nullstrike commented on May 22, 2024

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

from npx.

chetanbajaj avatar chetanbajaj commented on May 22, 2024

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

from npx.

Tokimon avatar Tokimon commented on May 22, 2024

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

from npx.

eyalewin-zz avatar eyalewin-zz commented on May 22, 2024

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)

from npx.

ajsaulsberry avatar ajsaulsberry commented on May 22, 2024

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)

from npx.

abd3 avatar abd3 commented on May 22, 2024

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

from npx.

falakejaz avatar falakejaz commented on May 22, 2024

Hi I got the same issue following solved mine
npm install -g create-react-app
then
npm create-react-app (your-app-name)

from npx.

jaworekplay avatar jaworekplay commented on May 22, 2024

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

from npx.

legendarynacar avatar legendarynacar commented on May 22, 2024

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.

from npx.

jraack avatar jraack commented on May 22, 2024

@sampana worked for me as well.

from npx.

mcb345 avatar mcb345 commented on May 22, 2024

@legendarynacar I tried changing npm cache location, no error, but still does not for (the npx)

@sampana removing npmrc doesnt seem to work too

from npx.

pasunmaa avatar pasunmaa commented on May 22, 2024

This helped with a small correction: npm install -g create-react-app

from npx.

tgVatsal avatar tgVatsal commented on May 22, 2024

I was getting the same issue, npm cache clean fixed it for me :)

from npx.

hdwebpros avatar hdwebpros commented on May 22, 2024

I was getting the same issue as well. I tried

I tried removing my .npmrc (C:\Users\My Name.npmrc)
I tried adding prefix=C:\Users\My Name to the .npmrc
I have cleared npm cache (npm cache clean --force)
I ran CMD as admin
I tried running npm config set prefix path/to/Actual_npm_folder

That is where I found my issue. After running that, I saw that the .npmrc file had
prefix=C:\Users\My in it.
It should have read prefix=C:\Users\My Name\AppData\Roaming\npm instead.

I manually changed that .npmrc file (make sure its uncommented too) to use the correct path for NPM (check your system environment variables for that path).

Run your command again and hopefully it will work.

NPM Version : 6.1.0
OS: Windows 10 Home 64 bit

from npx.

vicfabrice avatar vicfabrice commented on May 22, 2024

Still have the same problem after every step @hdwebpros did.
I changed .npmrc file, got this npm ERR! Could not install from "JustTheSecondPartOfMyUser\AppData\Roaming\npm-cache_npx\9944" as it does not contain a package.json file.

NPM Version: 5.6.0
OS: Windows 10 Home 64 bit

from npx.

hdwebpros avatar hdwebpros commented on May 22, 2024

@vicfabrice Did you specifically open that file, and find that line, and manually change it and save?

That's what made it work for me.

from npx.

hdwebpros avatar hdwebpros commented on May 22, 2024

@vicfabrice That sucks, but at least you have it working now. Hopefully this issue gets addressed soon for other users.

from npx.

sarvalkar avatar sarvalkar commented on May 22, 2024

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:76: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')) {
^

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:182:13)
at process._fatalException (internal/bootstrap/node.js:472: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:76: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')) {
^

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:182:13)
at process._fatalException (internal/bootstrap/node.js:472:27)

from npx.

sarvalkar avatar sarvalkar commented on May 22, 2024

Tell me what shuld i do?

from npx.

thedigitalbaboon avatar thedigitalbaboon commented on May 22, 2024

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

@edwardbrowncross this is working for me as well. Thanks a lot!

from npx.

aheggie avatar aheggie commented on May 22, 2024

tried @edwardbrowncross method and unfortunately it broke npm completely for me

`C:\Users\My Username\Documents\Code\React>npm version
fs.js:1670
binding.stat(baseLong);
^

Error: EPERM: operation not permitted, stat 'C:\Users\myusername'
at Object.realpathSync (fs.js:1670:17)
at toRealPath (module.js:158:13)
at Function.Module._findPath (module.js:207:22)
at Function.Module._resolveFilename (module.js:536:25)
at Function.Module._load (module.js:468:25)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
`

This exact error happens with npm <any_command> - not posting to criticise @edwardbrowncross but just one data point that this might happen if you try that solution.

from npx.

aheggie avatar aheggie commented on May 22, 2024

Update: deleting the symlink file created by the mklink command but not re-updating the caches seems to have both eliminated the above error and made npx create-react-app work

¯_(ツ)_/¯

thanks to @edwardbrowncross no thanks to computers

from npx.

sarvalkar avatar sarvalkar commented on May 22, 2024

D:>npm install -g
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')) {
^

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:182:13)
at process._fatalException (internal/bootstrap/node.js:491: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 ()
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')) {
^

from npx.

sarvalkar avatar sarvalkar commented on May 22, 2024

D:>npm install -g create-react-app
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')) {
^

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:182:13)
at process._fatalException (internal/bootstrap/node.js:491: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 ()
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:182:13)
at process._fatalException (internal/bootstrap/node.js:491:27)

D:>

from npx.

Atom8991 avatar Atom8991 commented on May 22, 2024

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)

It says "Access Denied" when I use this command.

from npx.

leofidus avatar leofidus commented on May 22, 2024

It says "Access Denied" when I use this command.

The workaround works for me. Make sure to execute the first command in an administrative powershell (right-click, "Run as Administrator")

from npx.

lyconear avatar lyconear commented on May 22, 2024

It work for me to git pull.

from npx.

jtsom avatar jtsom commented on May 22, 2024

Still seeing this issue while trying to use the npx command:

$ npx create-stencil ionic-pwa
Error: EPERM: operation not permitted, mkdir 'C:\Users\John'
TypeError: Cannot read property 'get' of undefined
    at errorHandler (C:\Users\John Tsombakos\AppData\Roaming\npm\node_modules\npm\lib\utils\error-handler.js:205:18)
    at C:\Users\John Tsombakos\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:78:20
    at cb (C:\Users\John Tsombakos\AppData\Roaming\npm\node_modules\npm\lib\npm.js:228:22)
    at C:\Users\John Tsombakos\AppData\Roaming\npm\node_modules\npm\lib\npm.js:266:24
    at C:\Users\John Tsombakos\AppData\Roaming\npm\node_modules\npm\lib\config\core.js:83:7
    at Array.forEach (<anonymous>)
    at C:\Users\John Tsombakos\AppData\Roaming\npm\node_modules\npm\lib\config\core.js:82:13
    at f (C:\Users\John Tsombakos\AppData\Roaming\npm\node_modules\npm\node_modules\once\once.js:25:25)
    at afterExtras (C:\Users\John Tsombakos\AppData\Roaming\npm\node_modules\npm\lib\config\core.js:173:20)
    at C:\Users\John Tsombakos\AppData\Roaming\npm\node_modules\npm\node_modules\mkdirp\index.js:47:53
C:\Users\John Tsombakos\AppData\Roaming\npm\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:\Users\John Tsombakos\AppData\Roaming\npm\node_modules\npm\lib\utils\error-handler.js:205:18)
    at process.emit (events.js:182:13)
    at process._fatalException (internal/bootstrap/node.js:485:27)
Install for create-stencil@latest failed with code 7

Any chance of this getting fixed?

@sudip1072 - What's the point of using npx if you just installed the command globally? npx is supposed to let you run a command WITHOUT installing it globally?

from npx.

bcollin avatar bcollin commented on May 22, 2024

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...

Latest patch appears to be #181.

from npx.

bcollin avatar bcollin commented on May 22, 2024

As a further data point, my prefix was set and escaped to the right value and yet I still got the reported error message.

@edwardbrowncross' work-around worked for me.

Wiki sez about junctions: "Unlike NTFS symbolic links, junction points can only link to an absolute path and only to a local volume; junction points from a local volume to a remote share are unsupported."

In other words they may not work for everybody.

from npx.

sarvold avatar sarvold commented on May 22, 2024

Thanks @edwardbrowncross . I confirm this works fine.

from npx.

fjfei avatar fjfei commented on May 22, 2024

Thanks @edwardbrowncross
node -v v8.15.0 "C:\Users\My Name" change "C:\Users\myname" ok

from npx.

DeeHants avatar DeeHants commented on May 22, 2024

For those recommending to run as admin, this opens a large security hole as it creates a new folder with admin perms, potentially blocking all other non admin apps from doing anything at all.
The correct workaround (until the code is fixed) is to make npm think your home directory does not have a space in using @edwardbrowncross 's suggestion above.

from npx.

sudhir600 avatar sudhir600 commented on May 22, 2024

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

  1. Open CMD in "Administrator" mode.
  2. npm cache clear --force
  3. npm install

It's worked for me.

from npx.

amatiasq avatar amatiasq commented on May 22, 2024

Tried everything mentioned here, only solution for me was to change the user name

https://www.top-password.com/blog/rename-user-profile-directory-in-windows/

from npx.

CLantigua2 avatar CLantigua2 commented on May 22, 2024

I had this same issue, did a search for my .npmrc file and put this in my prefix.
prefix=${HOME}/.npm-packages
it's the general default config. In my case I accidently changed the default config path which ended up breaking it.

from npx.

aymenjegham avatar aymenjegham commented on May 22, 2024

CMD as administrator solved it for me

from npx.

csenio avatar csenio commented on May 22, 2024

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

from npx.

ptolbert avatar ptolbert commented on May 22, 2024

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

from npx.

YogeshKanda avatar YogeshKanda commented on May 22, 2024

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.

from npx.

michelcve avatar michelcve commented on May 22, 2024

@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 ?

from npx.

sathish-spidie avatar sathish-spidie commented on May 22, 2024

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

from npx.

rizalamhadi avatar rizalamhadi commented on May 22, 2024

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

from npx.

lewismoten avatar lewismoten commented on May 22, 2024

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>

from npx.

solancer avatar solancer commented on May 22, 2024

image

Same issue

from npx.

mikepascual avatar mikepascual commented on May 22, 2024

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"

from npx.

ssfree0212 avatar ssfree0212 commented on May 22, 2024

it's may be helpful
https://alastaircrabtree.com/fixing-intermittant-eperm-operation-not-permitted-on-npm-install/

from npx.

luizmagao avatar luizmagao commented on May 22, 2024

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

This work for me too

Resolvido com esse código.

from npx.

JoFont avatar JoFont commented on May 22, 2024

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!

from npx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.