yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.44k stars 2.73k forks source link

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

Open benjaminsuch opened 6 years ago

benjaminsuch commented 6 years ago

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

daveit commented 6 years ago

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

samuelg123 commented 5 years ago

Problem still appears. Helpp

brandiqa commented 5 years ago

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.

giovannipds commented 5 years ago

@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 "create-next-app@9.0.7" 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 "create-next-app@9.0.7" 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.
brandiqa commented 5 years ago

@giovannipds What output do you get when you run:

yarn config get prefix
yarn config get cache-folder
giovannipds commented 5 years ago

@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!

axtscz commented 4 years ago

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

adrianwix commented 4 years ago

Still not working Yarn version: 2.0.0-rc.31

jefflafay commented 4 years ago

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

MoKamal commented 4 years ago

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?

albert-92 commented 4 years ago

Yup, same problem here.

rgomez90 commented 4 years ago

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.

pedrophos commented 4 years ago

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

farhan2077 commented 3 years ago

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.

ghost commented 3 years ago

Still failing.

Proposed solution works fine.

yarn config set cache-folder c:\root\yarn\cache
yarn config set prefix c:\root\yarn\packages
jordankittle commented 3 years ago

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.

cannap commented 3 years ago

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

LoganTann commented 3 years ago

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.

daveit commented 3 years ago

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

clossmans2 commented 2 years ago

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

cannap commented 2 years ago

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

KieranDevvs commented 2 years ago

@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.

dylandbl commented 2 years ago

Still suffering from this issue.

lawrencepenano commented 2 years ago

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

Willienn commented 2 years ago

Yep this error still up after 4 years

tkhashi commented 2 years ago

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'
aabmets commented 2 years ago

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.

KieranDevvs commented 2 years ago

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.

ashishlamsal commented 2 years ago

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.

Kavindu-Wijesekara commented 2 years ago

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

ioabhishek commented 1 year ago

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

it worked for me, Thanks a lot for sharing

rssabbirdev commented 1 year ago

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

@brandiqa Thanks man, finally its works.

ahmadyazdanii commented 1 year ago

it still here !

iamAkashNad commented 1 year ago

@giovannipds What output do you get when you run:

yarn config get prefix
yarn config get cache-folder

Thanks it works for me.

ahsan-abc commented 1 year ago

just i am trying npm to yarn but this user name containing space give same failed message , when I want to create next-app , it is 2023. image so no any option to use yarn , I decided to still I will use npm.

aabmets commented 1 year ago

@ahsan-abc have you considered pnpm? Or better yet, maybe give a try to bun? Yarn is so dead it aint even worth beating it with a stick.

ahsan-abc commented 1 year ago

@aabmets I appreciate your suggestions, but I'm not sure why you had to be so rude about Yarn. It's still a popular package manager, and I think it's not "dead." I've tried pnpm before and I'm not familiar with Bun, but I'll check it out.

Thank you for your help.

stampixel commented 1 year ago

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 also worked for me, only when I added in the quotations.

chasester commented 8 months ago

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 also worked for me, only when I added in the quotations.

So after looking at this, if you set it to "\" this probably treats it as a character escape in some CLIs. I use bash and it tried to remove all of the "\". So either adding the " " or using "/" instead is the safest option.

Cassiocominetti commented 8 months ago

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 is still a problem in 2024. The solution above worked for me! Thank you @tkhashi

Willienn commented 7 months ago

@Cassiocominetti Just a question. Its your yarn in the version 4? Just asking bc for me every time yarn install version 2 by default.

Cassiocominetti commented 7 months ago

@Cassiocominetti Just a question. Its your yarn in the version 4? Just asking bc for me every time yarn install version 2 by default.

@Willienn yarn version v1.22.19

Willienn commented 7 months ago

@Cassiocominetti if changing the version inst a problem, give v4 a try and see if it works better, its fixes a lot of bugs for me. (IDK why the installer dnst install the 4v by default)

plaraje commented 4 months ago

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.

This worked fine to me on yarn v1.22.22 edit: Anyways it should be fixed, but as a temporal fix if it works it works

KieranDevvs commented 4 months ago

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.

This worked fine to me on yarn v1.22.22

This isn't a solution. Paths containing usernames with spaces and special characters should be escaped.

aburifat commented 3 months ago

Same issue here and wondering why this isn't being solved till now?

vegerta commented 1 month ago

I have a same issue. Do you have a plan how can you fix it? Thanks

Cassiocominetti commented 1 month ago

I have a same issue. Do you have a plan how can you fix it? Thanks

https://github.com/yarnpkg/yarn/issues/6630#issuecomment-1999841259

This worked here! =) @vegerta @aburifat