[英]I can't run vue cli in Ubuntu - Error: Unable to access jarfile /snap/vue/1/jar/vue-1.0-SNAPSHOT.jar
I am trying to install vue cli for the first time.我正在尝试第一次安装 vue cli。
I tried using npm install -g @vue/cli
and yarn global add @vue/cli
and it seems to install correctly.我尝试使用
npm install -g @vue/cli
和yarn global add @vue/cli
,它似乎安装正确。
But if I run vue create my-project
or vue --version
, I get the following error:但是如果我运行
vue create my-project
或vue --version
,我会收到以下错误:
Picked up _JAVA_OPTIONS: -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
Error: Unable to access jarfile /snap/vue/1/jar/vue-1.0-SNAPSHOT.jar
My operative system is Ubuntu.我的操作系统是 Ubuntu。
I had the same problem, to solve:我有同样的问题,要解决:
sudo snap remove vue
npm install -g @vue/cli
OR或者
yarn global add @vue/cli
I have the same problem as mentioned but it's due to me not giving administrator privilege to the installation.我有同样的问题,但这是由于我没有给予管理员安装权限。 Therefore, I just have to give Administrator Privilege to the installation by typing sudo npm install -g @vue/cli .
因此,我只需要通过键入sudo npm install -g @vue/cli来授予管理员安装权限。 Then when I need to create Vue Project I just type sudo vue create <project_name> then it works fine.
然后,当我需要创建 Vue 项目时,我只需键入sudo vue create <project_name>即可。
let's try sudo snap remove vue
you will get something like: "vue removed", then try: vue
in the terminal and see if it works !让我们尝试
sudo snap remove vue
你会得到类似:“vue removed”,然后在终端尝试: vue
看看它是否有效! h H
The below solution is working for me in my ubuntu:以下解决方案适用于我的 ubuntu:
npm: npm:
sudo snap remove vue && npm install -g @vue/cli
sudo snap remove vue && npm install -g @vue/cli
yarn:纱:
sudo snap remove vue && yarn global add @vue/cli
sudo snap remove vue && yarn global add @vue/cli
And Reopen your terminal并重新打开您的终端
I using just this command lines我只使用这个命令行
1 - sudo snap remove vue 1 - sudo snap 删除 vue
2 - sudo npm install -g @vue/cli 2 -须藤 npm 安装 -g @vue/cli
and create vue project并创建 vue 项目
3 - sudo vue create <project_name> 3 - sudo vue 创建 <项目名称>
I fixed that using the vue-init
command rather than vue init
(which I've read that was the correct one).我使用
vue-init
命令而不是vue init
(我读过它是正确的)修复了这个问题。 The entire command used was:使用的整个命令是:
vue-init webpack-simple your-project-name
Then Vue-cli will ask you a series of questions such as project name, description and author.然后 Vue-cli 会问你项目名称、描述和作者等一系列问题。
Hope that helps.希望有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.