This error is usually caused when the user's environment is not set up correctly. To fix it, you will need to edit your ~/.bashrc file and add the following lines:
export EDITOR='emacs -nw'
export VISUAL='emacs -nw'
Save the file and exit. Then, run the source ~/.bashrc command to reload the file. Now, try running the command again. It should work.