Vue-cli: `Error: spawn yarn ENOENT` on `vue create` with a clean install

Created on 21 Sep 2020  路  10Comments  路  Source: vuejs/vue-cli

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

Most helpful comment

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.

All 10 comments

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

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)

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

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.

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?

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: https://github.com/vuejs/vue-cli/issues/5690

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

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

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 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"
}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CodeApePro picture CodeApePro  路  3Comments

chasegiunta picture chasegiunta  路  3Comments

miyamoto-san picture miyamoto-san  路  3Comments

BusyHe picture BusyHe  路  3Comments

csakis picture csakis  路  3Comments