vue-cli: `Error: spawn yarn ENOENT` on `vue create` with a clean install
Version
4.5.6
Environment info
N/A
Steps to reproduce
- Globally install vue-cli
- 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
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 3
- Comments: 17 (2 by maintainers)
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.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.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” }
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”
For Windows users uninstall and reinstall yarn it will solve your issue. npm uninstall yarn npm install --global yarn