Crontab job cannot find idevice_id

I have a crontab job that should run my appium tests from a .jar. But when I check the logs it shows that it cannot access device_id to run on a real device. I have tried to set the path correctly but with no success.

ex.

[XCUITest] Error: Unknown device or simulator UDID: ‘iphone udid’
at XCUITestDriver.determineDevice$ (…/…/lib/driver.js:581:17)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at run (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/es6.promise.js:108:47)
at /usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/es6.promise.js:119:28
at flush (/usr/local/lib/node_modules/appium/node_modules/core-js/library/modules/$.microtask.js:19:5)
at nextTickCallbackWith0Args (node.js:453:9)
at process._tickCallback (node.js:382:13)
[Error: Unknown device or simulator UDID: ‘iphone udid’]
[MJSONWP] Encountered internal error running command: Error: Unknown device or simulator UDID: ‘iphone udid’

Make sure that the user who owns the crontab job has device_id in their path. Most people run crontab jobs as root, but there are alternatives: