Vue 无法执行“ui”命令

错误信息

D:\git\blog>vue ui

D:\git\blog>vue help ui
internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module 'D:\git\blog\vue-ui'
�[90m    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)�[39m
�[90m    at Function.Module._load (internal/modules/cjs/loader.js:842:27)�[39m
�[90m    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)�[39m
�[90m    at internal/main/run_main_module.js:17:47�[39m {
  code: �[32m'MODULE_NOT_FOUND'�[39m,
  requireStack: []
}

检查

D:\git\blog>vue -h
Usage: vue <command> [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
  create         (for v3 warning only)
  help [cmd]     display help for [cmd]

发现并没有ui的命令,于是想到可能vue-cli未安装成功,所以需要重新安装vue-cli

npm install -g @vue/cli
或
cnpm install -g @vue/cli

安装完成后,再次查看命令

D:\git\blog>vue -h
Usage: vue <command> [options]

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

Commands:
  create [options] <app-name>                create a new project powered by vue-cli-service
  add [options] <plugin> [pluginOptions]     install a plugin and invoke its generator in an already created project
  invoke [options] <plugin> [pluginOptions]  invoke the generator of a plugin in an already created project
  inspect [options] [paths...]               inspect the webpack config in a project with vue-cli-service
  serve [options] [entry]                    serve a .js or .vue file in development mode with zero config
  build [options] [entry]                    build a .js or .vue file in production mode with zero config
  ui [options]                               start and open the vue-cli ui
  init [options] <template> <app-name>       generate a project from a remote template (legacy API, requires @vue/cli-init)
  config [options] [value]                   inspect and modify the config
  outdated [options]                         (experimental) check for outdated vue cli service / plugins
  upgrade [options] [plugin-name]            (experimental) upgrade vue cli service / plugins
  migrate [options] [plugin-name]            (experimental) run migrator for an already-installed cli plugin
  info                                       print debugging information about your environment

  Run vue <command> --help for detailed usage of given command.

发现已经有ui命令了,执行命令如下:

D:\git\blog>vue ui
�  Starting GUI...
�  Ready on http://localhost:8000

综上所述,说明未正确安装vue-cli,重新安装后,一切正常。

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容