Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: spawn yarn ENOENT on vue create with a clean install #5891

Open
TheDutchCoder opened this issue Sep 21, 2020 · 17 comments
Open

Error: spawn yarn ENOENT on vue create with a clean install #5891

TheDutchCoder opened this issue Sep 21, 2020 · 17 comments

Comments

@TheDutchCoder
Copy link

TheDutchCoder commented Sep 21, 2020

Version

4.5.6

Environment info

N/A

Steps to reproduce

  1. Globally install vue-cli
  2. Run vue create [myprojectname]

What is expected?

The project to be created

What is actually happening?

An error is thrown when creating the project (default options)

Error: spawn yarn ENOENT
@TheDutchCoder
Copy link
Author

Apparently there was a stray yarn config that clashes with vue-cli. Odd.
I removed it and now it works.

@TheDutchCoder
Copy link
Author

That was premature, now there's an error when actually creating the project:

 ERROR  Error: spawn yarn ENOENT
Error: spawn yarn ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)

@TheDutchCoder TheDutchCoder reopened this Sep 21, 2020
@TheDutchCoder TheDutchCoder changed the title "Invalid version" on vue create command (clean install) Error: spawn yarn ENOENT on vue create with a clean install Sep 21, 2020
@LinusBorg
Copy link
Member

can you give us a little bit more information about your environment what is your node version what is your yarn version etc?

Also could you provide a little bit more information when exactly the error is occurring? you wrote that it happens after trying to create a project with default options - a screenshot of the terminal, showing which of the steps were already done or in progress before the error appeared would be helpful

@TheDutchCoder
Copy link
Author

Okay, so I just figured out that vue-cli requires yarn.
If I install yarn globally through Homebrew the create function works fine.

That might be worth adding to the docs? I'm still a little confused why it would require yarn though.

@LinusBorg
Copy link
Member

LinusBorg commented Sep 21, 2020

It does not require yarn. It work with both npm and yarn. And it checks which is available on your system and then chooses that. You can also force it to use one or the other with a flag. This is documented in the guide,. though could likely be more prominant.

For some reason, it seems to have falsely "detected" yarn on your system - maybe from a prior install was was not completely removed?

@TheDutchCoder
Copy link
Author

TheDutchCoder commented Sep 21, 2020

I uninstalled yarn completely and vue-cli only started working when I reinstalled yarn through Homebrew again.

Doesn't seem to make a ton of sense (I only use npm but had yarn installed from waaaay back apparently). Other people are also having this issue by the way, see: #5690

@corepay
Copy link

corepay commented Sep 27, 2020

Same errors here with npm global install. using nvm do not want to cross-pollute node with brew-node.

vui ui allows me to create projects however. cli is broken here in my town

@mstjepan28
Copy link

I had an issue when I deleted Yarn from windows that some files stayed in AppData\Local\Yarn. Deleting them solved the problem for me

@shauryadhadwal
Copy link

shauryadhadwal commented Nov 4, 2020

I also had the same issue. I am using Ubuntu.
I used vue-cli before, so there is a file create ~/.vuerc which saves all your presets.
In here, package manager was set as "yarn" which I no longer had. After deleting the file and using vue create,
I was prompted to select package manager. The issue was resolved post this.

Note: Before this, I installed yarn with which the error was resolved. But would recommend to use the above method.

@andersenmp
Copy link

I also had the same issue. I am using Ubuntu.
I used vue-cli before, so there is a file create ~/.vuerc which saves all your presets.
In here, package manager was set as "yarn" which I no longer had. After deleting the file and using vue create,
I was prompted to select package manager. The issue was resolved post this.

Note: Before this, I installed yarn with which the error was resolved. But would recommend to use the above method.

I've got the same issue after removing yarn in Windows 10. Package Manager was set to yarn on my ~/.vierc file

{
"useTaobaoRegistry": false,
"packageManager": "yarn"
}

@andres-k
Copy link

andres-k commented Feb 4, 2021

I also had the same issue. I am using Ubuntu.
I used vue-cli before, so there is a file create ~/.vuerc which saves all your presets.
In here, package manager was set as "yarn" which I no longer had. After deleting the file and using vue create,
I was prompted to select package manager. The issue was resolved post this.

Note: Before this, I installed yarn with which the error was resolved. But would recommend to use the above method.

Thank you. I also ran into the same issue using ASDF for managing different node environments and this gave me a lot of headache.

Deleting the ~/.vuerc file solved the issue.

@stuheiss
Copy link

tl;dr If you previously installed yarn with brew run "brew unlink yarn && brew link yarn"

I had the same issue immediately after updating vue-cli. This apparently removed /usr/local/bin/yarn which is the symlink created by running "brew install yarn" and points to /usr/local/Cellar/yarn/1.22.10/bin/yarn. Fix is to recreate the symlink /usr/local/bin/yarn by running "brew unlink yarn && brew link yarn"

@aritro-rakshit
Copy link

aritro-rakshit commented Jun 15, 2021

For Windows users uninstall and reinstall yarn it will solve your issue.
npm uninstall yarn
npm install --global yarn

@pointer
Copy link

pointer commented Jul 6, 2021

@aritro-rakshit ...thanks

@binodnepali
Copy link

binodnepali commented Jul 27, 2021

I also came across the same issue. I have npm and yarn both installed globally in my system. But the vue-cli (4.1.2) could not choose (or prompt me to choose) the package manager. I have fixed it by setting a flag vue create -m npm project-name and it worked for me.

@zhuweiyou
Copy link

@andersenmp Thank you! Your answer solved my problem.

@tako-sphynx
Copy link

tako-sphynx commented Nov 30, 2022

I also had the same issue. I am using Ubuntu. I used vue-cli before, so there is a file create ~/.vuerc which saves all your presets. In here, package manager was set as "yarn" which I no longer had. After deleting the file and using vue create, I was prompted to select package manager. The issue was resolved post this.

Note: Before this, I installed yarn with which the error was resolved. But would recommend to use the above method.

Hi. I have the same error after npm create some-project. want to use your solution but can't find ~/.vuerc file. Can you help me somehow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests