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

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


Solution 1:[1]

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.

Solution 2:[2]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Randeep Rana