asdf-vm / asdf-nodejs

Node.js plugin for asdf version manager

Home Page:https://github.com/asdf-vm/asdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues in running test scripts from Eclipse with Appium shim

kanadgodse-lh opened this issue · comments

Hello,

I'm having issue with running appium command from Eclipse where I get this error:

[INFO ] 2023-09-14 20:01:24.856 com.qa.utils.ServerManager:22 - starting appium server
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
/Users/kanadgodse/.asdf/shims/appium:2
# asdf-plugin: nodejs 16.14.0
^

SyntaxError: Invalid or unexpected token
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1032:15)
    at Module._compile (node:internal/modules/cjs/loader:1067:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47
      io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException: The local appium server has not been started. The given Node.js executable: /Users/kanadgodse/.asdf/shims/node Arguments: [/Users/kanadgodse/.asdf/shims/appium, --port, 32885, --address, 0.0.0.0, --log, /Users/kanadgodse/eclipse-workspace/navendor-global-app-test/Android_Pixel 4a/Server.log, --session-override] 

I am trying to run this on Apple MacBook Pro M1 14 inch with macOS Ventura (13.5.2 (22G91))

Here are the other versions:

asdf: v0.13.1
nodejs: v16.14.0
appium: 2.1.3
eclipse: 2021-12 (4.22.0)
Java:
openjdk 11.0.15 2022-04-19 LTS
OpenJDK Runtime Environment Zulu11.56+19-CA (build 11.0.15+10-LTS)
OpenJDK 64-Bit Server VM Zulu11.56+19-CA (build 11.0.15+10-LTS, mixed mode)

I can run the appium command just fine from terminal, but am facing issue when running it from Eclipse.

I have even tried starting Eclipse from terminal so that it could pick up the environment of the terminal but I still face this issue.

Kindly help me out with this and let me know the solution.

Thanks.

I found the solution by digging into the AppiumServiceBuilder.java file's source code where I was using the withAppiumJS method and it mentioned in the comment that it requires an executable appium.js or main.js file.

So, I had to hunt for the main executable that the asdf shim links to and I found it at /Users/kanadgodse/.asdf/installs/nodejs/16.14.0/lib/node_modules/appium/index.js which when used in my code was able to start the scripts.

Am putting this here so that anyone else having the same issue could find this helpful.