Issues with running Appium CLI on Mac

I’m attempting to get appium working on Mac via bash.

So far I’ve done the following:

  1. Installed appium via ‘npm install -g appium’
  2. Linked folders via ‘ln -fs /usr/local/Cellar/node/16.4.2/lib/node_modules/appium/lib/main.js /usr/local/bin/appium’
  3. Added PATH to /usr/local/bin

Now when I’m attempting to start server via ‘appium’ command, I get the following error:

(node:16835) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/usr/local/Cellar/node/16.4.2/lib/node_modules/appium/lib/main.js:4
import { init as logsinkInit, clear as logsinkClear } from './logsink';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1025:15)
    at Module._compile (node:internal/modules/cjs/loader:1059:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:816:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at node:internal/main/run_main_module:17:47

I’ve also double checked that my node is up to date. This seems like a setup issue to me so far. I’m just not sure what I’m missing here.

Appreciate the help!

This error is most likely happening because the destination script is wrong. The correct (transpiled) one must be located in the build folder

1 Like

Yep! That’s what it was. Got it running now.
Thank you.