在Linux中找不到命令”wails”,安装Wails Go时出现错误。

huangapple go评论88阅读模式
英文:

Command 'wails' not found in linux, Error installing wails Go

问题

我正在尝试在Ubuntu 22.04上安装wails

我的系统上已经安装了Go版本go1.20.3和NPM版本6.14.11

我按照官方网站教程中的所有步骤进行操作。

上述教程中提到的步骤没有出现任何错误。

但是当我尝试以下命令时:

$ wails version

或者

$ wails doctor

我会收到以下错误信息:

$ Command 'wails' not found
英文:

I'm trying to install wails in Ubuntu 22.04.

Go version go1.20.3 and NPM version 6.14.11 are already installed on my system.

I followed all steps from the official website tutorial.

There have been no errors with the steps mentioned in above tutorial.

But when I try the following command

$ wails version

or

$ wails doctor

then I get the error

$ Command 'wails' not found

答案1

得分: 2

go已经安装在我的系统中

当我运行go version命令时,它能够正确运行

但是go安装的目录home/[用户名]/go/bin/没有添加到PATH环境变量中

我按照以下步骤将其添加到PATH环境变量中:

  1. 打开终端

  2. 打开~/.bashrc文件

$ nano ~/.bashrc
  1. 转到文件底部并添加以下行
$ export PATH=$PATH:/home/[用户名]/go/bin/

> 你应该使用go/bin文件夹的实际路径,即go安装的路径
>
> 不要忘记在末尾添加斜杠/

  1. 按下Ctrl + X退出nano编辑器,并输入**"Y"**保存更改。
  2. 最后运行以下命令
$ source ~/.bashrc

> PATH成功添加

现在当我运行wails version命令时,不会再出现错误。

在Linux中找不到命令”wails”,安装Wails Go时出现错误。

英文:

go is already installed in my system

when I run go version command it run correctly

but the directory where go installed that is home/[username]/go/bin/ was not added in PATH environment.

I followed these steps to add it in PATH environment:

  1. Opened the terminal

  2. Open the ~/.bashrc file

$ nano ~/.bashrc
  1. Go to bottom of the file and add following line
$ export PATH=$PATH:/home/[username]/go/bin/

> you should use the actual path of go/bin folder where the go is installed
>
> don't forget to add / at the end

  1. Press Ctrl + X to exit nano editor, and type "Y" to save changes.
  2. Finally run the following command
$ source ~/.bashrc

> PATH is successfully added

Now when I run wails version command it don't give me any error.

在Linux中找不到命令”wails”,安装Wails Go时出现错误。

答案2

得分: 1

看起来像是一个环境变量的问题,请查看关于此问题的常见问题解答(https://wails.io/docs/guides/troubleshooting/#the-wails-command-appears-to-be-missing)。

将其添加到bashrc可能不足以解决您的问题,您应该在.profile中设置您的环境变量。请查看这些回答,解释了用于设置环境变量的可用文件(https://serverfault.com/q/261802)。

英文:

It looks like an environement variable issue, take a look at the faq about that (https://wails.io/docs/guides/troubleshooting/#the-wails-command-appears-to-be-missing)

Adding it to bashrc may not be enough to fix your issue, You should probably set your environement variables in .profile. Take a look at those awnsers explaining the avalible files used to set up environement varaibles https://serverfault.com/q/261802

答案3

得分: 1

按照以下命令操作:

export GOPATH=~/go 
go install github.com/wailsapp/wails/v2/cmd/wails@latest
export PATH=$PATH:$(go env GOPATH)/bin
source ~/.bashrc
wails version

在终端中输入以下命令查看版本号:

wails version

输出结果应为:

v2.4.1

英文:

Follow These Commands

export GOPATH=~/go 
go install github.com/wailsapp/wails/v2/cmd/wails@latest
export PATH=$PATH:$(go env GOPATH)/bin
source ~/.bashrc
wails version

devn@macbook-pro-2 ~ % wails version
v2.4.1

huangapple
  • 本文由 发表于 2023年4月27日 15:10:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/76117666.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定