Vue-cli: Can not create project by vue-cli

Created on 4 Dec 2018  ·  14Comments  ·  Source: vuejs/vue-cli

Version

3.2.1

Environment info

System:
    OS: macOS 10.14.1
    CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
  Binaries:
    Node: 10.9.0 - ~/.nvm/versions/node/v10.9.0/bin/node
    Yarn: Not Found
    npm: 6.2.0 - ~/.nvm/versions/node/v10.9.0/bin/npm
  Browsers:
    Chrome: 70.0.3538.110
    Firefox: 63.0.3
    Safari: 12.0.1
  npmGlobalPackages:
    @vue/cli: 3.2.1

Steps to reproduce

Run command "vue create my-app"

What is expected?

Create new project

What is actually happening?

Command "vue create" is not working

enhancement cli

All 14 comments

What options did you choose? Any error messages?

What options did you choose? Any error messages?

I don't use any option. I just use "vue create my-app"

So what do you mean by "not working"? There should be an error message. Otherwise checkboxes would be displayed for you to choose.

So what do you mean by "not working"? There should be an error message. Otherwise checkboxes would be displayed for you to choose.

There is not show any things on my screen, no error message, no checkbox. I've wait 2 hours and my screen is not changed

Which terminal emulator did you use?
Non-interactive shells may fail to run vue create.
There's also a warning in our documentation:

If you are on Windows using Git Bash with minTTY, the interactive prompts will not work. You must launch the command as winpty vue.cmd create hello-world.
If you however want to still use the vue create hello-world syntax, you can alias the command by adding the following line to your ~/.bashrc file.
alias vue='winpty vue.cmd'
You will need to restart your Git Bash terminal session to pull in the updated bashrc file.

Just figured it out.
You must be stuck by the getVersions logic:
https://github.com/vuejs/vue-cli/blob/ae2a9bc145b04f009046cf65e82c233f5bd54039/packages/%40vue/cli/lib/util/clearConsole.js#L7

Check the ~/.vuerc file and toggle its useTaobaoRegistry field.

It's either because @vue/cli failed to fetch https://registry.npmjs.com/vue-cli-version-marker/latest or it failed to get https://registry.npm.taobao.org/vue-cli-version-marker/latest. Toggle useTaobaoRegistry and it will try to use the other registry url.

@sodatea Is there something left to do? It was added to the Jan update, then removed, and util I removed it, it stil have the "needs repro" flag.

Do you intend to make a change or something?

@LinusBorg I planned to add a timeout for all network requests in the creator, which will make such problems easier to identify.
In the “January Update” project I only changed the issue card to a reference with a few notes... don’t know why github thought I was removing it.

我遇到了相同的问题,很高兴在这里找到了解决方法,但是当我试图去修改文件vuerc时,我发现我找不到这个文件,我在我的计算机里全局搜索了,没有这个文件,我现在输入vue -V可以打印出2.9.1,我输入vue,打印结果是

Usage: vue [options]

Options:

-V, --version  output the version number
-h, --help     output usage information

Commands:

init        generate a new project from a template
list        list available official templates
build       prototype a new project
help [cmd]  display help for [cmd]

vue/cli的版本是3.3.0

@againF 可能你系统路径里仍然有 vue-cli 2.x,请先运行 npm uninstall -g vue-cli。另外好像 nvm 可能存在无法彻底删除某个全局包的问题,如果仍然运行上述命令后仍然无法解决的话请彻底卸载 nvm 再重装试试。

@sodatea 非常感谢,是我的问题,vue很棒,我修改过npm安装的全局路径,但是环境变量没有正确配置,修改环境变量后,问题解决了。你及时的解答提醒了我,非常感谢。

image

I have got nodejs 12.14.1 version and npm 4.1.2 version. I have windows 10 machine. I installed vue version 4.1.2 but couldn't create project through vue create hello-world e.g. I have attached the screenshot. Please help me. It is just not working on my laptop.

@haidery786 Try running vue config --set useTaobaoRegistry false first.
Seems that on the first run, the CLI incorrectly inferred that your connection to registry.npm.taobao.org is faster than registry.npmjs.org and set that flag, but in reality, the connection to the taobao registry is so slow that the installation stalls.

Hey @sodatea
That did work for me. Thanks a lot😊

Was this page helpful?
0 / 5 - 0 ratings