lex: command not found

Have You tried accessing the binary with the full path?

Maybe Your $PATH variable doesn't contain the default paths? echo $PATH should give something like:

[root@server ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

If it's empty, You may set the PATH variable with this command

export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"

On CentOS possible default full paths are:

/usr/bin/lex - from package: flex

You may install the required package with command yum install {package}

On Debian possible default full paths are:

/usr/bin/lex - from package: flex-old
/usr/bin/lex - from package: flex

You may install the required package with command apt-get install {package}
Error in other languages:
lex: bevel nie gevind nie
lex: comandă negăsită
lex: comando não encontrado
lex: commande introuvable
lex: command not found
lex: käsku ei ole
lex: không tìm thấy lệnh
lex: komanda nerasta
lex: Kommando nicht gefunden.
lex: kommandot finns inte
lex: komut yok
lex: nie znaleziono polecenia
lex: níor aimsíodh an t-ordú
lex: no se encontró la orden
lex: no s'ha trobat l'ordre
lex: opdracht niet gevonden
lex: parancs nem található
lex: perintah tidak ditemukan
lex: príkaz nenájdený
lex: příkaz nenalezen
lex: команда не найдена
lex: командата не е открита
lex: 命令找不到
lex: コマンドが見つかりません