3.4.0
Environment Info:
System:
OS: Linux 4.20 Fedora 29 (Workstation Edition) 29 (Workstation Edition)
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Binaries:
Node: 10.14.1 - /usr/bin/node
Yarn: Not Found
npm: 6.4.1 - /usr/bin/npm
Browsers:
Chrome: 72.0.3626.81
Firefox: 65.0
npmGlobalPackages:
@vue/cli: 3.3.0 (reverted, this one works while latest is broken)
Wizard starts, asking for options e.g. which package manager to use.
Yarn is missing (although not needed), wizard and childprocess crash.
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)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
Any attempts in forcing npm as a packageManager (via .vuerc) were futile, either returning the same error or this one:
ERROR ~/.vuerc may be outdated. Please delete it and re-run vue-cli in manual mode.
Can't reproduce.
Unless you've got yarnpkg
installed but no yarn
command presents, I don't see any code logic to produce such errors.
Tried to reproduce again and failed (today was my third install of version 3.4.0).
CLI 3.4.0 now also let's me choose presets I have created with version 3.3.0.
Issue might be still reproducible with a clean machine. Or maybe I just had a bad download : /
closing.
I ran into a similar issue with a very similar error message, which I could not figure out for a long time. I wanted to record what I discovered in the hope that it could help someone in the future.
When I would create new Vue projects with vue create <project name>
it would create a yarn.lock
file, even though I was using npm. So I tried uninstalling Yarn and removing all necessary Yarn files to prevent this from happening. After uninstalling Yarn, I got a Error: spawn yarn ENOENT
message in my terminal (very similar to the one shown above) and I could not create any Vue projects.
After trying a bunch of things, I reinstalled Yarn and everything worked again. I could see that Vue CLI was clearly creating projects with Yarn, but I didn't know why. And then I came across this post: https://github.com/vuejs/vue-cli/issues/1300. I also read the documentation that explains the .vuerc
file here: https://cli.vuejs.org/guide/creating-a-project.html#vue-create. That solved everything. I opened the ~/.vuerc
file and set the package manager to npm
and all is well now.
@SamuelEarl Thank you for the hint with.vuerc
. That solved a problem!
had the same issue.
i removed ~/.vuerc
file, and now it works.
I had the same problem today. I had installed yarn before via npm and then removed it recently. npm list had only two packages.
don@don-mbp changemark % npm list -g --depth=0
/usr/local/lib
├── @vue/[email protected]
└── [email protected]
I checked ~/.vuerc
and and some Vue CLI selected yarn as the package manager. It will be interesting to see how vuecli determines the package manager installed on the host.
removing the ~/.vuerc file fixed the problem for me.
I had yarn
installed through brew
.
Uninstalling yarn
and reinstalling it worked for me.
I guess in my case, I tampered some core files for node while I was switching between different versions of nodejs using nvm. In the process I modified some globally installed packages, which is where I guess, @vue/cli was tampered.
I had the same problem and removing the .vuerc
worked fine for me.
I'm using nodebrew
for Node.js version manegement.
I had run vue create
with v12.10.0
of node and it was okay that time. (I think I had installed yarn
via npm
.)
Then, I switched node version to v12.16.1
by nodebrew use v12.16.1
and run vue create
.
The following error message shows up this time.
ERROR Error: spawn yarn ENOENT
Error: spawn yarn ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
I removed the .vuerc
:
{
"useTaobaoRegistry": false,
"packageManager": "yarn",
"presets": {
"default": {
"useConfigFiles": false,
"plugins": {
"@vue/cli-plugin-babel": {},
"@vue/cli-plugin-eslint": {
"config": "airbnb",
"lintOn": [
"save"
]
}
}
}
}
}
and after vue create
it became :
{
"useTaobaoRegistry": true
}
@hayashi-ay
An additional tip: if you are outside China, maybe useTaobaoRegistry: false
works better for you.
We set this flag by pinging different registries on the first run. If it's set to true
than a mirror registry inside China is used to install dependencies.
But the mirror is inside China so most other users won't benefit from it. So if you are not in China, I guess there's a misjudgment in the pinging process. Set it back to false
can avoid potential issues in the future.
@sodatea thanks for explaining the useTaobaoRegistry
. I'm in Japan, so I switched it to false
.
@sodatea Hi there, I've just come up with three questions. Please let me know if it doesn't bother you.
I also glanced at the pinning process and found that the option is likely to be true
in Japan because of the geographic factor.
Can I create PR about the modification of the process?
The output of pinning to the both registries is below. I found that the taobao registry win the promise race with a higly probability.
$ ping -c 10 registry.npmjs.org
PING registry.npmjs.org (104.16.19.35): 56 data bytes
64 bytes from 104.16.19.35: icmp_seq=0 ttl=56 time=14.654 ms
64 bytes from 104.16.19.35: icmp_seq=1 ttl=56 time=5.648 ms
64 bytes from 104.16.19.35: icmp_seq=2 ttl=56 time=8.810 ms
64 bytes from 104.16.19.35: icmp_seq=3 ttl=56 time=12.804 ms
64 bytes from 104.16.19.35: icmp_seq=4 ttl=56 time=13.898 ms
64 bytes from 104.16.19.35: icmp_seq=5 ttl=56 time=12.059 ms
64 bytes from 104.16.19.35: icmp_seq=6 ttl=56 time=7.670 ms
64 bytes from 104.16.19.35: icmp_seq=7 ttl=56 time=5.449 ms
64 bytes from 104.16.19.35: icmp_seq=8 ttl=56 time=5.936 ms
64 bytes from 104.16.19.35: icmp_seq=9 ttl=56 time=5.591 ms
--- registry.npmjs.org ping statistics ---
10 packets transmitted, 10 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 5.449/9.252/14.654/3.547 ms
$ ping -c 10 registry.npm.taobao.org
PING registry.npm.taobao.org.w.cdngslb.com (202.47.28.95): 56 data bytes
64 bytes from 202.47.28.95: icmp_seq=0 ttl=52 time=8.073 ms
64 bytes from 202.47.28.95: icmp_seq=1 ttl=52 time=13.499 ms
64 bytes from 202.47.28.95: icmp_seq=2 ttl=52 time=8.884 ms
64 bytes from 202.47.28.95: icmp_seq=3 ttl=52 time=7.240 ms
64 bytes from 202.47.28.95: icmp_seq=4 ttl=52 time=13.869 ms
64 bytes from 202.47.28.95: icmp_seq=5 ttl=52 time=18.765 ms
64 bytes from 202.47.28.95: icmp_seq=6 ttl=52 time=6.975 ms
64 bytes from 202.47.28.95: icmp_seq=7 ttl=52 time=13.956 ms
64 bytes from 202.47.28.95: icmp_seq=8 ttl=52 time=6.983 ms
64 bytes from 202.47.28.95: icmp_seq=9 ttl=52 time=7.068 ms
--- registry.npm.taobao.org.w.cdngslb.com ping statistics ---
10 packets transmitted, 10 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 6.975/10.531/18.765/3.953 ms
@hayashi-ay I guess because Japan is so close to China, the connectivity is fine. Then you'll be fine with either registry.
what kind of issue I may encounter if I set the option true?
In other countries, it may take too long to download from the mirror registry: https://github.com/vuejs/vue-cli/issues/5144 https://github.com/vuejs/vue-cli/issues/1385
- why the mirror registry inside China is necessary?
- what is the difference between the default and the mirror?
In China, home broadband users are likely to face QoS issues when accessing oversea servers. So downloading from the official npm registry may be slow unless you are using commercial broadband.
Besides, due to the GFW, many websites are not accessible in China including most Google servers (making chromedriver
binary CDN inaccessible). I also believe that connection Amazon S3 storage (which hosts binary files for many npm packages) is throttled so that downloading is extremely slow.
When useTaobaoRegistry
is set, Vue CLI will install dependencies with that mirror registry, and try to work around the binary downloading issue by setting environment variables. You can see the relevant code here: https://github.com/vuejs/vue-cli/blob/v4.2.3/packages/%40vue/cli/lib/util/ProjectPackageManager.js#L166
Most helpful comment
I ran into a similar issue with a very similar error message, which I could not figure out for a long time. I wanted to record what I discovered in the hope that it could help someone in the future.
When I would create new Vue projects with
vue create <project name>
it would create ayarn.lock
file, even though I was using npm. So I tried uninstalling Yarn and removing all necessary Yarn files to prevent this from happening. After uninstalling Yarn, I got aError: spawn yarn ENOENT
message in my terminal (very similar to the one shown above) and I could not create any Vue projects.After trying a bunch of things, I reinstalled Yarn and everything worked again. I could see that Vue CLI was clearly creating projects with Yarn, but I didn't know why. And then I came across this post: https://github.com/vuejs/vue-cli/issues/1300. I also read the documentation that explains the
.vuerc
file here: https://cli.vuejs.org/guide/creating-a-project.html#vue-create. That solved everything. I opened the~/.vuerc
file and set the package manager tonpm
and all is well now.