sdetweil / MMM-Config

testing
30 stars 3 forks source link

test_convert.sh: line 4: realpath: command not found #10

Closed jalibu closed 3 years ago

jalibu commented 3 years ago

System MacOS

Steps to reproduce

  1. Clone MMM-Config
  2. npm i inside MMM-Config folder (successful without problems)
  3. Start MM with "npm run server"
  4. Check Server Logfiles
[ERROR] stderr 2: /Users/me/git/MagicMirror/modules/MMM-Config/test_convert.sh: line 4: realpath: command not found
stat: illegal option -- -
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
stat: illegal option -- -
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
find: ../default: No such file or directory
internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module '/Users/me/git/MagicMirror/scripts/buildschema3.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
jalibu commented 3 years ago

Unfortunately there is no realpath on MacOS :-/

You could consider using an own realpath function that calls the native function (if present) or

realpath() {
    path=`eval echo "$1"`
    folder=$(dirname "$path")
    echo $(cd "$folder"; pwd)/$(basename "$path"); 
}

Source: https://stackoverflow.com/questions/3572030/bash-script-absolute-path-with-os-x

jalibu commented 3 years ago

Or just add this to your readme:

MacOs Users must
install [homebrew](https://brew.sh/)
brew install coreutils
sdetweil commented 3 years ago

or add that to the postinstall script

sdetweil commented 3 years ago

realpath isn't in the coreutils anyhow..

I have pushed a fix give it a try, looks good here, git pull

sdetweil commented 3 years ago

I believe that this is fixed for you, as you also tested the port fix successfully

please confirm

jalibu commented 3 years ago

I uninstalled coreutils (which solved the problem for me yesterday) and it still works. good job

sdetweil commented 3 years ago

thanks for the fast update