Skip to content
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.

npx returning Error: EPERM: operation not permitted on Windows, with spaces in path #209

Open
jtsom opened this issue Sep 20, 2018 · 12 comments

Comments

@jtsom
Copy link

jtsom commented Sep 20, 2018

As has been reported before, and (supposedly fixed), trying to run an npx command on Windows returns the above error. Full log below.

Info:

$ npm config list
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.4.1 node/v10.10.0 win32 x64"

; builtin config undefined
prefix = "C:\\Users\\John Tsombakos\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\Users\John Tsombakos
; HOME = C:\Users\John Tsombakos
; "npm config ls -l" to show all defaults.

node --version
v10.10.0
npm -v
6.4.1
npx -v
6.4.1 (also fails with npx@latest)

Error log:

 npx webpack-bundle-analyzer .\dist\stats.json
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 webpack-bundle-analyzer@latest failed with code 7
@paulcyr
Copy link

paulcyr commented Sep 27, 2018

This appears to be a duplicate of #100

@jtsom
Copy link
Author

jtsom commented Dec 3, 2018

Any movement on this? The Duplicate #100 is still open. Can't use npx on Windows...

@assadullahchaudhry
Copy link

I'm on Windows 10 Professional. I got the same issue and I got it fixed by running the following commands in command prompt.

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

works

@anthonyaoun23
Copy link

I'm on Windows 10 Professional. I got the same issue and I got it fixed by running the following commands in command prompt.

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

works

Thank you! This solved the problem for me.

@assadullahchaudhry
Copy link

I'm on Windows 10 Professional. I got the same issue and I got it fixed by running the following commands in command prompt.

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

works

Thank you! This solved the problem for me.

You are welcome.

@silverqx
Copy link

Same problem here

@drdanmorris
Copy link

Doing an
npm install -g create-react-app
isn't really a solution per se, as the entire point of $ npx is to avoid the need for global installs. Modules like create-react-app change so frequently that they are typically out of date soon after installing them. So npx then allows you to execute a package without actually installing it, thereby ensuring that you are always using the latest cut of the module.

I had the same issue described above (EPERM) and the following thread - specifically the npm config set trick using ~1 - resolved the problem for me.

`


< hello >

    \   ^__^
     \  (oo)\_______
        (__)\       )\/\
            ||----w |
            ||     ||

`

@silverqx
Copy link

I had the same issue described above (EPERM) and the following thread - specifically the npm config set trick using ~1 - resolved the problem for me.

I didn't find that thread, ~1 solution will work, thx

@KRISHANJIT
Copy link

I just wanted to run:
npx create-react-app react-tutorial
I found it works after I use:
npm install -g create-react-app

GOT THE FOLLOWING MESSAGE :
Installing react, react-dom, and react-scripts...

  • react-dom@16.8.4
  • react@16.8.4
  • react-scripts@2.1.8

@emilyxiemao
Copy link

Thanks

@doll612
Copy link

doll612 commented Apr 27, 2019

I'm on Windows 10 Professional. I got the same issue and I got it fixed by running the following commands in command prompt.

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

works

Thank you! This solved the problem for me.

You are welcome.

@jojosati
Copy link

Similar problem with some meaningful message.

PS C:\Users\Miix 320> npx create-react-app test-app
npm ERR! code ENOLOCAL
npm ERR! Could not install from "320\AppData\Roaming\npm-cache\_npx\3304" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Miix 320\AppData\Roaming\npm-cache\_logs\2019-05-11T06_30_56_843Z-debug.log
Install for create-react-app@latest failed with code 1

Look like there is problem somewhere in npx script with default path of npm-cache.

There is a npx's option --cache.
So I create a folder c:\temp and successfully call npx with this option

md c:\temp
npx --cache c:\temp create-react-app test-app

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants