So today I got this annoying message from rake
that I have seen way too many times. It looks something like the following:
$ rake updb
scripts/updb.sh
rake aborted!
Command failed with status (127): [./scripts/updb.sh...]
/path/to/Rakefile:16:in `block in <top (required)>'
Tasks: TOP => updb
(See full trace by running task with --trace)
Status 127 is code for “command not found.” The problem was caused by my Rakefile which had a task called “updb” which I use to upload the current local copy of a database to production. And it looks like this:
The problem here is that even though the script is set to be executable, it’s still not in $PATH
and even though ./scripts/updb.sh
will actually run on the command line, we need to specify the shell to run and pass the script as an argument. The working task now looks like this:
If you run into the same issue:
- try double checking that the command you are running is in your
$PATH
and that it is actually a command. - If the command is not in your path, either move it there or use the full path name to it. You can make this cleaner by using a variable to store the path to the command.
- Call any scripts using their respective interpreters and pass the file names as arguments.