<p>Your shell cannot find the <code>go</code> binary in the <code>PATH</code> thats because when you use <code>sudo</code> the command is run in a new environment and some environment variable can not be there like <code>PATH</code> Here is how to fix that:</p>
<p>open a terminal then open the sudo configuration file in a text editor with <code>sudo visudo</code> then add <code>:/usr/local/go/bin</code> at the end of <code>Defaults</code> <code>secure_path=</code></p>
<p>If you still have problem try to reinstall your <code>go</code></p>

CC BY-SA 4.0
2023-03-30T10:33:01.243Z
The -E flag was not the solution but got me on the right track. Change your answer to something like this and I can mark it as correct answered. 
open sudo config with sudo visudo and add :/usr/local/go/bin at the end of Defaults secure_path =
Luca F
CC BY-SA 4.0
2023-03-30T18:20:55.280Z
okay, thats a working solution :)
Saxtheowl
CC BY-SA 4.0
2023-03-29T18:52:41.810Z
2023-03-30T18:20:25.890Z
2023-03-30T18:20:25.890Z
Saxtheowl
<p>I try to install LND like this:</p>
<pre><code>git clone https://github.com/lightningnetwork/lnd
cd lnd
sudo make install
</code></pre>
<p>I get the following error:</p>
<pre><code>/bin/sh: 1: go: not found
make: *** [Makefile:112: install] Error 127
</code></pre>
<p>Go is installed. Go version:</p>
<pre><code>go version go 1.20.2 linux/arm
</code></pre>
<p>.profile PATH is exported:</p>
<pre><code>export PATH=$PATH:/usr/local/go/bin
</code></pre>
<p>.bashrc contains:</p>
<pre><code>export GOPATH=~/go
export PATH=$PATH:$GOPATH/bin
</code></pre>
<p>Thanks in advance</p>

<lightning-network-daemon><linux>
LND make install Error 127
Luca F
# LND make install Error 127

(Asked by: username_0 on 2023-03-29)

I try to install LND like this:
git clone https://github.com/lightningnetwork/lnd
cd lnd
sudo make install

I get the following error:
/bin/sh: 1: go: not found
make: *** [Makefile:112: install] Error 127

Go is installed. Go version:
go version go 1.20.2 linux/arm

.profile PATH is exported:
export PATH=$PATH:/usr/local/go/bin

.bashrc contains:
export GOPATH=~/go
export PATH=$PATH:$GOPATH/bin

Thanks in advance

**Tags:** lightning-network-daemon, linux


---

## 1 answers

### Answer by username_1 on 2023-03-29. Score: 1 | Accepted answer

Your shell cannot find the `go` binary in the `PATH` thats because when you use `sudo` the command is run in a new environment and some environment variable can not be there like `PATH` Here is how to fix that:

open a terminal then open the sudo configuration file in a text editor with `sudo visudo` then add `:/usr/local/go/bin` at the end of `Defaults` `secure_path=`

If you still have problem try to reinstall your `go`

> **Comments:**
> **username_0**: The -E flag was not the solution but got me on the right track. Change your answer to something like this and I can mark it as correct answered.  open sudo config with sudo visudo and add :/usr/local/go/bin at the end of Defaults secure_path =  
> **username_1**: okay, thats a working solution :)  

---

