Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

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

@billnbell

Description

@billnbell

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"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions