yarn icon indicating copy to clipboard operation
yarn copied to clipboard

Having white spaces in your Windows username fails the "create" command

Open benjaminsuch opened this issue 6 years ago • 49 comments

As the title specifies I'm not able to run the create command since I have a white space in my username on Windows. In this case it says "Can't find the command C:\Users\Benjamin".

Yarn version: 1.12.1 Node version: 10.13.0

benjaminsuch avatar Nov 04 '18 14:11 benjaminsuch

I can confirm this, I have the same issue - my user name is c:\users\Fred Bloggs\ (not my real name :) )

daveit avatar Nov 13 '18 07:11 daveit

Problem still appears. Helpp

samuelg123 avatar Apr 02 '19 07:04 samuelg123

Here 's a workaround I've used:

yarn config set cache-folder c:\root\yarn\cache
yarn config set prefix c:\root\yarn\packages

Basically configure yarn not to use folders inside your USER folder.

brandiqa avatar Sep 30 '19 07:09 brandiqa

@brandiqa unfortunately it didn't solve it to me.

λ yarn create next-app --example with-zones with-zones-app
yarn create v1.19.0
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
      - create-next-app
[####] 4/4'C:\Users\Spaced' is not recognized as an internal or external command,
operable program or batch file.
error Command failed.
Exit code: 1
Command: C:\Users\Spaced User\AppData\Local\Yarn\bin\create-next-app
Arguments: --example with-zones with-zones-app
Directory: C:\Users\Spaced User\Desktop
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

After that:

λ yarn create next-app --example with-zones with-zones-app
yarn create v1.19.0
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
      - create-next-app
System cannot find the path specified.
error Command failed.
Exit code: 1
Command: C:\Yarn\Packages\bin\create-next-app
Arguments: --example with-zones with-zones-app
Directory: C:\Users\Spaced User\Desktop
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

giovannipds avatar Oct 05 '19 16:10 giovannipds

@giovannipds What output do you get when you run:

yarn config get prefix
yarn config get cache-folder

brandiqa avatar Oct 05 '19 17:10 brandiqa

@brandiqa hey! Thanks for getting in touch! I was so in hurry that I made it anyway, I read somewhere that if I run the command directly, it would run, so I just ran it directly:

create-next-app --example with-zones with-zones-app

And all gone well. Thanks anyway!

giovannipds avatar Oct 07 '19 21:10 giovannipds

I found out this issue still exists, and the fix mentioned still works, but it would be nice if this could get fixed to not need a workaround

axtscz avatar Mar 19 '20 13:03 axtscz

Still not working Yarn version: 2.0.0-rc.31

adrianwix avatar Mar 31 '20 17:03 adrianwix

I can confirm this is still an issue with yarn v1.22.4

jefflafay avatar Apr 10 '20 14:04 jefflafay

As of today, this issue still exists on yarn 1.22.4 for Windows path with spaces, e.g. C:\Users\My Name\AppData, etc, is there any permanent fix for this?

MoKamal avatar May 21 '20 11:05 MoKamal

Yup, same problem here.

albert-92 avatar May 28 '20 14:05 albert-92

Same problem. Unfortunately @brandiqa's workaround didn't work for me

Here 's a workaround I've used:

yarn config set cache-folder c:\root\yarn\cache
yarn config set prefix c:\root\yarn\packages

Basically configure yarn not to use folders inside your USER folder.

rgomez90 avatar Jun 20 '20 16:06 rgomez90

Here 's a workaround I've used:

yarn config set cache-folder c:\root\yarn\cache
yarn config set prefix c:\root\yarn\packages

Basically configure yarn not to use folders inside your USER folder.

thats work for me, thanks

pedrophos avatar Aug 03 '20 22:08 pedrophos

Here 's a workaround I've used:

yarn config set cache-folder c:\root\yarn\cache
yarn config set prefix c:\root\yarn\packages

Basically configure yarn not to use folders inside your USER folder.

Ty, it worked like a charm.

farhan2077 avatar Mar 14 '21 09:03 farhan2077

Still failing.

Proposed solution works fine.

yarn config set cache-folder c:\root\yarn\cache
yarn config set prefix c:\root\yarn\packages

ghost avatar Jun 21 '21 10:06 ghost

I just ran into this problem. Using yarn to install a strapi-starter gatsby blog failed. Using npx worked. I guess I will be going back to npm.

jordankittle avatar Jul 01 '21 19:07 jordankittle

same here rename the userfolder of windows is just horrible hope for a fix

cannap avatar Jul 17 '21 11:07 cannap

The issue stills happens nowadays... No idea about how to fix the bug?

I know this is a bad practice having username with spaces, but I cannot change this.

LoganTann avatar Sep 13 '21 08:09 LoganTann

Options are:

Create another user with no spaces just for development.

Or

Install Windows sub system.

Dave

From: ShinProg (Logan Tann) @.> Sent: Monday, 13 September 2021 4:12 PM To: yarnpkg/yarn @.> Cc: Dave Porter @.>; Comment @.> Subject: Re: [yarnpkg/yarn] Having white spaces in your Windows username fails the "create" command (#6630)

The issue stills happens nowadays... No idea about how to fix the bug?

I know this is a bad practice having username with spaces, but I cannot change this.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/yarnpkg/yarn/issues/6630#issuecomment-917947833 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOR4WL5IOHL7JY7JCSUBOTUBWW4HANCNFSM4GBVKXYQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AAOR4WJJFTUKK5VZDXETHC3UBWW4HA5CNFSM4GBVKXY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOG23MLOI.gif

daveit avatar Sep 13 '21 08:09 daveit

Can confirm. Still happening on Windows 11, and approaching 4 years since this issue was opened.

clossmans2 avatar May 29 '22 16:05 clossmans2

same and yes renaming username on windows is just a horrible solution :D

cannap avatar Jun 05 '22 16:06 cannap

@daveit

The issue stills happens nowadays... No idea about how to fix the bug?

I know this is a bad practice having username with spaces, but I cannot change this.

Bad practice?!? Stop making excuses for buggy software. I've used spaces in my Win usernames for 18+ years, never have I had a single suite of software fail because of this until nodejs / yarn.

KieranDevvs avatar Jun 26 '22 14:06 KieranDevvs

Still suffering from this issue.

dylandbl avatar Jun 28 '22 20:06 dylandbl

Hi, this works for me.

For example:

C:\Users\John Doe

Running yarn create next-app will fail with

'C:\Users\John' is not recognized as an internal or external command.

If setting cache folder for yarn and npm does not seem to work, try changing the environment variable LOCALAPPDATA which points to the app data in your home directory.

First, check 8.3 directory name with (on your terminal) dir C:\Users /x C:\Users\John should look like C:\Users\JOHN~1.

Then, set the environment variable with (on your terminal) set LOCALAPPDATA=C:\Users\JOHN~1\AppData\Local Now, yarn create should work.

link to original https://stackoverflow.com/questions/54379046/yarn-gives-error-when-creating-react-application

lawrencepenano avatar Jul 03 '22 18:07 lawrencepenano

Yep this error still up after 4 years

Willienn avatar Sep 09 '22 12:09 Willienn

I had same problem.

Here 's a workaround I've used:

yarn config set cache-folder c:\root\yarn\cache
yarn config set prefix c:\root\yarn\packages

It worked for me :) I surround path with quotation. ('{path}')

yarn config set cache-folder 'c:\root\yarn\cache'
yarn config set prefix 'c:\root\yarn\packages'

tkhashi avatar Sep 18 '22 13:09 tkhashi

Why is this still not fixed? How is it reasonable to expect the user to implement some cache folder hacks in order to get elementary functionality out of yarn? This is preposterous.

aabmets avatar Oct 12 '22 10:10 aabmets

Why is this still not fixed? How is it reasonable to expect the user to implement some cache folder hacks in order to get elementary functionality out of yarn? This is preposterous.

This is one of the reasons I try to avoid JS and its ecosystem as much as possible.

KieranDevvs avatar Oct 12 '22 13:10 KieranDevvs

Faced the same issue today. It's 2022 and issue is still open 😞. Had to use this workaround. This works!

Here 's a workaround I've used:

yarn config set cache-folder c:\root\yarn\cache
yarn config set prefix c:\root\yarn\packages

Basically configure yarn not to use folders inside your USER folder.

ashishlamsal avatar Oct 13 '22 09:10 ashishlamsal

I had same problem.

Here 's a workaround I've used:

yarn config set cache-folder c:\root\yarn\cache
yarn config set prefix c:\root\yarn\packages

It worked for me :) I surround path with quotation. ('{path}')

yarn config set cache-folder 'c:\root\yarn\cache'
yarn config set prefix 'c:\root\yarn\packages'

This worked for me thanks

Kavindu-Wijesekara avatar Oct 25 '22 10:10 Kavindu-Wijesekara