During the process of building gitlab according to the official website, we encountered sudo gem command not found problem. The solution is to modify the/etc/sudoers file and find the defaults secure_ The line path =/SBIN/bin/usr/SBIN/usr/bin can also be commented and deleted, so that the path will not be reset during dsudo