npm/npx

[BUG] NPX doesnt work if path has any spaces in it

ItsRauf opened this issue · 6 comments

What / Why

When running npx in a path that has spaces in it, npx fails

Current Behavior

  • fails with Error: EPERM: operation not permitted, mkdir 'C:\Users\Rauf'

Steps to Reproduce

  • have a path with a space in it (ex: C;\Users\Rauf Islam\code\portfolio)

Expected Behavior

  • npx should continue after the space to get the full path

Hi,
I would like to work on this issue. Please assign it to me.
Thanks.

There was a PR for this in the previous repo. See zkat/npx#181, zkat/npx#138 and zkat/npx#100

Run CMD in administrator mode and fire below commands in order

  1. Run cmd as administrator
  2. Run npm config edit (You will get notepad editor)
  3. Change prefix variable to C:\Users<User Name>\AppData\Roaming\npm
  4. npm install -g create-react-app
    Thanks.

I think I've found the solution:

  1. Run npm config edit
  2. Add these lines:
cache=C:\Users\Rauf~1\AppData\Roaming\npm-cache
globalconfig=C:\Users\Rauf~1\AppData\Roaming\npm\etc\npmrc
init-module=C:\Users\Rauf~1\.npm-init.js
tmp=C:\Users\Rauf~1\AppData\Local\Temp
userconfig=C:\Users\Rauf~1\.npmrc
globalignorefile=C:\Users\Rauf~1\AppData\Roaming\npm\etc\npmignore

I found this useful and working for me -
https://stackoverflow.com/a/46871748/12581294

If there were already PR's fixing this, when will the fix be released?