0

Can't run npx commands in windows 8.1 pro. showing error

Error: EPERM: operation not permitted, mkdir 'C:\Users\MY'

my folder path contains space. full command and error here.

C:\Users\MY PC\Desktop\renaitv>npx create-react-app tsst
Error: EPERM: operation not permitted, mkdir 'C:\Users\MY'
command not found: create-react-app
Hanoon IH
  • 1
  • 2

2 Answers2

0

Try creating a symbolic link from C:\Users\MY PC\Desktop\renaitv to C:\Users\MY%20PC\Desktop\renaitv where %20 represents the space.

Command line commands distinguish different segments of the command, argument, and options using spaces. As you can tell this is in particular an issue with default Windows folders ("My Documents", "User/First Last", etc).

Normally to get around the issue, you can simply surround arguments with "" or '' characters. But when you don't control the command being invoked you can create a symbolic link between the original folder path and a file URI encoded folder path.

Alan Cheung
  • 244
  • 1
  • 7
  • I tried `mklink /D "C:\Users\MY PC\Desktop\renaitv" C:\Users\MY%20PC\Desktop\renaitv` but it failed. says: `Cannot create a file when that file already exists.` – Hanoon IH Jan 03 '21 at 09:26
  • Ah yeah the order is weird on the command. It should be `mklink [options] ` So `mklink /D C:\Users\MY%20PC\Desktop\renaitv "C:\Users\MY PC\Desktop\renaitv"` Also I apologize, I never actually explained the issue, will edit the answer. – Alan Cheung Jan 04 '21 at 13:56
0

Restart your PC and run VS code as Administrator. It will work.