ELMO
ELMO

Reputation: 643

The command could not be located because '/snap/bin' is not included in the PATH environment variable

when i try to run git-all-secrets i got Dockerfile: command not found and this is the command include correct information

here is an example of the issue

root@momo22:/home/momo/git-all-secrets# docker run -it abhartiya/tools_gitallsecrets -token=9a8b60a10cf683f238e05 -org=bugcrwod
Command 'docker' is available in '/snap/bin/docker'
The command could not be located because '/snap/bin' is not included in the PATH environment variable.
docker: command not found
root@momo22:/home/momo/git-all-secrets# 

Upvotes: 45

Views: 135508

Answers (6)

Adebayo Vicktor
Adebayo Vicktor

Reputation: 89

  • open ~/.bash_profile
  • add export PATH=$PATH:/snap/bin and save the changes
  • run source ~/.bash_profile

you can open ~/.bash_profile with vi or gedit

Upvotes: 0

Masoud Aghaei
Masoud Aghaei

Reputation: 804

  1. Open the ~/.bashrc with nano or vim => vim ~/.bashrc
  2. add export PATH=$PATH:/snap/bin at the end of the file
  3. log out from your user and log in again or reboot

if ~/.bashrc doesn't exist:

  1. create ~/.bashrc file and open it => touch ~/.bashrc && vim ~/.bashrc
  2. add PATH=$PATH:/snap/bin
  3. logout from your user and login again or reboot

if you don't want to logout or reboot run these commands:

  1. sudo su ${USER}
  2. bash

Upvotes: 0

AntonOfTheWoods
AntonOfTheWoods

Reputation: 952

If you come here and are just on Ubuntu rather than docker and you have just installed snapd without logging out/in again, log out then in again - you don't need to modify any files.

Upvotes: 1

Jika
Jika

Reputation: 395

you can add the path into .bashrc file

$ echo 'export PATH=$PATH:/snap/bin' >> ~/.bashrc

open new terminal or execute this command

$ source ~/.bashrc

Upvotes: 27

Jay Harry
Jay Harry

Reputation: 221

To fix this issue do the following:

  1. Open the file /etc/environment.
  2. Add /snap/bin to the end of the PATH Variable and concatenate using the : character.

    Example lets assume we had the PATH variable in the file was: Path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"

    After your update this will look like: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/snap/bin

  3. Finally to update your shell and have the PATH variable ready to use, run source /etc/environment
  4. Done

Upvotes: 20

Harry S
Harry S

Reputation: 1105

Temporary solution:

Run the command export PATH=$PATH:/snap/bin

Permanent solution:

Edit /etc/environment and add /snap/bin in the list then restart your system.

Links

answer for similar error with same fix
More info on /etc/enviroment

Upvotes: 96

Related Questions