0

I'm currently a student and I must installed Jhipster for a project, the installation seems to work fine but I faced many problems. Indeed, when I want to compile jdl files, I want to do it with a sudo but jhipster is not find only when I used sudo (without it it works)

with sudo

Furthermore when I tried to launch a Jhipster project I must do ./mnvw or sudo ./mnvw. Here again when I use sudo, a warning spawn with the following message : "Warning: JAVA_HOME environment variable is not set.". This warning is not here when I don't put sudo.

So I would like to know why theses commands doesn't work with sudo, I don't have any troubles with other commands. Thanks in advances for your help, sorry for my english level and all the mistakes I made.

Quentin
  • 486
  • 4
  • 20
  • 2
    `jhipster` may be an alias or shell function, rather than an executable file. `sudo` also ignores your environment for security reasons. – chepner Feb 11 '19 at 15:25
  • Yes, I found that sudo doesn't access cause of the path, I created an alias "sudo2" with the following command : "alias sudo2='sudo -E env "PATH=$PATH"'" Problem solved – Quentin Feb 11 '19 at 15:30
  • @pjh You're right, my bad ! I will edit my answer to include the link ! – Quentin Feb 11 '19 at 20:30

1 Answers1

0

Ok, I solved my problem, I don't know if the way I did it is "clean" but I created an alias in my bashrc with the following text :

alias sudo2='sudo -E env "PATH=$PATH"'

Now I use sudo2 to launch Jhipster or mnvw

I know it's not good to answer to ourself but it's for helping if someone face the same problem in the future ;)

Another similar subject with high voted answers : Command not found when using sudo

Quentin
  • 486
  • 4
  • 20