Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting weird ESM error - goes away if I delete yarn.lock #927

Open
billnbell opened this issue May 8, 2023 · 1 comment
Open

Getting weird ESM error - goes away if I delete yarn.lock #927

billnbell opened this issue May 8, 2023 · 1 comment

Comments

@billnbell
Copy link

This one is weird. Docker image node:16 or node:18.

Running yarn install I get the following on this:

[1/5] ⠄ appium-chromedriver
[2/5] ⠄ sharp
[3/5] ⠄ appium
[4/5] ⠄ bundletool
error /node_modules/appium: Command failed.
Exit code: 1
Command: node ./scripts/autoinstall-extensions.js
Arguments: 
Directory: /node_modules/appium
Output:
/node_modules/appium/scripts/autoinstall-extensions.js:43
  require('wrap-ansi'),
  ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /node_modules/wrap-ansi/index.js from /node_modules/appium/scripts/autoinstall-extensions.js not supported.
Instead change the require of index.js in /node_modules/appium/scripts/autoinstall-extensions.js to a dynamic import() which is available in all CommonJS modules.

Not sure how to fix it properly. But if I delete yarn.lock I can run yarn install and everything is fine.

Here is my package.json:

{
  "scripts": {
    "ios:appium:index": "npx appium  --base-path /wd/hub",
    "android:appium:index": "npx appium  --base-path /wd/hub",
    "android:local": "tsc && npx wdio ./src/wdio.and.ts",
    "android:remote": "tsc && npx wdio ./src/wdio.bs.and.ts",
    "ios:local": "tsc && npx wdio ./src/wdio.ios.ts",
    "ios:remote": "tsc && npx wdio ./src/wdio.bs.ios.ts",
    "build": "tsc",
    "doctor": "appium-doctor --ios",
    "doctor:android": "appium-doctor --android",
    "lint": "npx eslint --ext ts,tsx,js ./src && npx tsc --pretty"
  },
  "devDependencies": {
    "@appium/doctor": "^2.0.14",
    "@types/chai": "^4.3.5",
    "@types/node": "18",
    "@wdio/local-runner": "^8.8.8",
    "@wdio/mocha-framework": "^8.8.7",
    "@wdio/spec-reporter": "^8.8.7",
    "bundletool": "^1.1.7",
    "ts-node": "^10.9.1",
    "typescript": "^5.0.4"
  },
  "dependencies": {
    "@aws-sdk/client-s3": "^3.321.1",
    "@wdio/appium-service": "^8.8.8",
    "@wdio/browserstack-service": "^8.8.8",
    "@wdio/cli": "^8.8.8",
    "appium": "^2.0.0-beta.46",
    "appium-doctor": "^1.16.2",
    "appium-uiautomator2-driver": "^2.22.1",
    "appium-xcuitest-driver": "^4.25.1",
    "aws-sdk": "^2.1368.0",
    "chai": "^4.3.7",
    "fs": "^0.0.1-security",
    "mjpeg-consumer": "^2.0.0",
    "s3-sync-client": "^3.0.3",
    "wd": "^1.14.0",
    "webdriverio": "^8.8.8"
  }
}
@billnbell
Copy link
Author

It also happens if I rm -rf node_modules && yarn install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant