-
-
Notifications
You must be signed in to change notification settings - Fork 105
Running npx globally does not work on Windows when the user folder patch contains a space #146
Comments
I have exactly same issue with npx due to space in path. |
Any fix for this ? |
I have found a workaround. After do this, comes the hard part: Press Be careful with this part: Press you can find that steps here. For me, this was worked fine |
OK, I was excited to see this npx, it looked very interesting, but this bug makes it just unusable. Too bad. |
you can change "npm-cache" folder to anothor path, |
if you want to use current path that has space in username "C:\Users\Firstname Lastname\AppData\Roaming\npm-cache" npm config set cache "C:\Users\Firstname~1\AppData\Roaming\npm-cache" --global |
This is a duplicate of #100 |
The above error is due the white space contain in your username of PC. The command npx create-react-app doesn't work in this situation and shows error. I have fixed the error and created my first react app. |
@citoreek Great, this fixes the problem I am having.Thanks! |
Done fixing both npm and npx. |
I did the all changes as described by @citoreek. after that i am getting new error-
Note sure what should i do |
I had a similar error on Ubuntu WSL on Windows 10, and tried just dropping npx, so calling just
and it seems to work now |
On Windows, I fixed it in #146 (comment) 's way:
|
don't forget to remove the ';' at the beginning of the line |
@citoreek It's a bit more complicated. You remove all the spaces from the folder name, then you take the first 6 characters of the folder name and postfix it with ~1. Officialy, you should also uppercase it, but I found it doesn't make a difference. So the full path of my folder was: If you want to be sure, you can use |
Why is this issue closed? |
I download the latest version of node |
Thanks killian-coder , but it should be fixed soon |
Thank you for this. No one explained before that you only need the first six characters. If you have any more characters than 6 then it goes and creates a new folder. |
It is the first 6 characters that have an entry in the ASCII table. If you have strange characters, they also don't count for the short folder name. |
I'm wondering the same thing. The issue is not resolved. |
to get the exact tilde short path,
Then copy the shown username and paste in the above command |
Another simple fix for spaces problem would be |
the best answer....it really works!!! thank you!! |
* Temporarily update NPM cache when a space in path exists. FIXES #238 * Move chace check after npx check
This may be related to issue #110, but I believe it is separate. However, I have tried the various fixes suggested in that thread.
When running npx (with any arguments, but -v is easiest to test) from the global install folder, the following error is produced.
It seems that npx is not properly escaping any spaces contained in the
npm config prefix
variable.The full error log file
Note lines 1, 13, and 17.
Notice how the path is split on lines 1, and how the space is improperly escaped on line 13. The entire path needs to be in a string, but npx seems to be splitting it into two strings.
This issue seems specific to npx, as other npm commands seem to use the prefix directory correctly.
This is running npx 9.6.0 on node 9.3.0 on Windows 10.
The issue does not happen when the user directory contains no spaces, or when running npx locally from within a project folder.
The text was updated successfully, but these errors were encountered: