Vue CLI 不再询问功能选择
Vue CLI no longer asks a for feature selection
使用 Vue CLI v4 和命令创建新的 Vue (2.x) 项目时:
vue create example
...系统会提示我选择要启用的功能。出于某种原因,CLI 会直接跳转到创建项目,大概具有我之前选择的功能。
如何让 cli 让我再次指定功能?
您的项目似乎设置了 prompt=false 并使用 JSON 创建项目。据我所知,你应该设置 prompt=true 或者对于每个项目使用应该使用:
vue create example --default
这应该会提示功能(>手动 select 功能)。
在 Vue 的文档中,您可以找到创建项目选项 creating projects with Vue
在Reactgo页面中,他们展示了项目创建过程的一些特点How to create Vue project
您的 Vue CLI 安装似乎有点过时了。
作为第一次修复尝试,我会尝试删除用户主目录 (~/.vuerc
) 中的 .vuerc
文件,Vue CLI 存储已保存的预设。
如果这没有帮助,我建议全局重新安装 Vue CLI 包:
全局重新安装 Vue CLI 的步骤
# If Vue CLI is installed globally, remove the installation
# Check globally installed packages list with NPM
npm list -g --depth 0
# OR with Yarn
yarn global ls
# Depending on which package manager it has been installed with
# Uninstall with NPM
npm uninstall -g @vue/cli
# OR with Yarn
yarn global remove @vue/cli
# Install currently newest Vue CLI version with NPM
npm install -g @vue/cli
# OR with Yarn
yarn global add @vue/cli
我的问题是我使用 Git Bash 到 vue create app-name
而不是 Windows CMD。
一旦我重新运行 Windows CMD 中的命令,Vue 功能选择就可以正常工作。
使用 Vue CLI v4 和命令创建新的 Vue (2.x) 项目时:
vue create example
...系统会提示我选择要启用的功能。出于某种原因,CLI 会直接跳转到创建项目,大概具有我之前选择的功能。
如何让 cli 让我再次指定功能?
您的项目似乎设置了 prompt=false 并使用 JSON 创建项目。据我所知,你应该设置 prompt=true 或者对于每个项目使用应该使用:
vue create example --default
这应该会提示功能(>手动 select 功能)。
在 Vue 的文档中,您可以找到创建项目选项 creating projects with Vue
在Reactgo页面中,他们展示了项目创建过程的一些特点How to create Vue project
您的 Vue CLI 安装似乎有点过时了。
作为第一次修复尝试,我会尝试删除用户主目录 (~/.vuerc
) 中的 .vuerc
文件,Vue CLI 存储已保存的预设。
如果这没有帮助,我建议全局重新安装 Vue CLI 包:
全局重新安装 Vue CLI 的步骤
# If Vue CLI is installed globally, remove the installation
# Check globally installed packages list with NPM
npm list -g --depth 0
# OR with Yarn
yarn global ls
# Depending on which package manager it has been installed with
# Uninstall with NPM
npm uninstall -g @vue/cli
# OR with Yarn
yarn global remove @vue/cli
# Install currently newest Vue CLI version with NPM
npm install -g @vue/cli
# OR with Yarn
yarn global add @vue/cli
我的问题是我使用 Git Bash 到 vue create app-name
而不是 Windows CMD。
一旦我重新运行 Windows CMD 中的命令,Vue 功能选择就可以正常工作。