在Ubuntu 18.04上使用Vue 2.9.4时,所有命令都会返回错误"Unknown command“
compustretch@instance-1:~/vuetest$ vue init webpack testapp
Unknown command init.
vue-cli · Failed to download repo vuejs-templates/[object Object]: Response code 404 (Not Found)
compustretch@instance-1:~/vuetest$ vue list
Unknown command list.
Available official templates:
★ browserify - A full-featured Browserify + vueify setup with hot-reload, linting & unit testing.
★ browserify-simple - A simple Browserify + vueify setup for quick prototyping.
★ pwa - PWA template for vue-cli based on the webpack template
★ simple - The simplest possible Vue setup in a single HTML file
★ webpack - A full-featured Webpack + vue-loader setup with hot reload, linting, testing & css extraction.
★ webpack-simple - A simple Webpack + vue-loader setup for quick prototyping.
compustretch@instance-1:~/vuetest$ vue help init
Unknown command help.
vue-[object Object](1) does not exist, try --help
compustretch@instance-1:~/vuetest$ vue --version
2.9.4
compustretch@instance-1:~/vuetest$希望有人知道为什么会发生这样的事情,因为我一直在研究这个问题,但在搜索结果中什么都没有。
发布于 2018-05-31 15:15:27
您需要使用此命令npm uninstall -g vue-cli卸载
然后用下面的命令npm install -g @vue/cli安装v3 (不知道为什么他们会升级到当前的2.9.4版本)
此外,它们还将要求您安装额外的东西,如init,list等
更新:
忘了npm install -g @vue/cli吧,因为它仍然是测试版,当你使用其他库时,它会给你带来很多问题。
我建议你试试这个命令npm install -g vue-cli@2.9.3,它会帮你省去很多麻烦。
发布于 2018-06-01 02:00:24
我用这个解决方案解决了我的问题:
全局卸载以前版本的npm uninstall -g vue-cli
npm install -g @vue/cli-init的
https://stackoverflow.com/questions/50618143
复制相似问题