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

fix: install-npm.js fails to run npm run build due to type error #292

Merged
merged 3 commits into from
Mar 16, 2023

Conversation

rerorero
Copy link
Contributor

node install-npm.js in the current main branch doesn't work due to tsc error.
e.g. https://github.com/appium/appium-chromedriver/actions/runs/4403909094/jobs/7720201682

After letting it show the error details with util.inspect(e), npm install failed like this:

npm install
npm WARN config init.author.name Use `--init-author-name` instead.
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '>=18' },
npm WARN EBADENGINE   current: { node: 'v16.15.1', npm: '8.11.0' }
npm WARN EBADENGINE }

> [email protected] postinstall
> node install-npm.js

[23:50:48] The Chromedriver install script cannot be found at '/Users/rerorero/go/src/github.com/rerorero/appium-chromedriver/build/lib/install.js'. Building appium-chromedriver package

/Users/rerorero/go/src/github.com/rerorero/appium-chromedriver/node_modules/teen_process/lib/exec.js:129
        let err = new Error(`Command '${rep}' exited with code ${code}`);
                  ^
Error: appium-chromedriver package cannot be built: Error: Command 'npm run build' exited with code 1
    at ChildProcess.<anonymous> (/Users/rerorero/go/src/github.com/rerorero/appium-chromedriver/node_modules/teen_process/lib/exec.js:129:19)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
  stdout: '\n' +
    '> [email protected] build\n' +
    '> tsc -b\n' +
    '\n' +
    "lib/utils.js(134,62): error TS2345: Argument of type '{}' is not assignable to parameter of type 'DriverOpts<Readonly<Record<string, Constraint>>>'.\n" +
    "  Type '{}' is missing the following properties from type 'ServerArgs': address, allowCors, allowInsecure, basePath, and 26 more.\n",
  stderr: 'npm WARN config init.author.name Use `--init-author-name` instead.\n',
  code: 1
}
    at main (/Users/rerorero/go/src/github.com/rerorero/appium-chromedriver/install-npm.js:41:13)
npm ERR! code 1
npm ERR! path /Users/rerorero/go/src/github.com/rerorero/appium-chromedriver
npm ERR! command failed
npm ERR! command sh -c node install-npm.js

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/rerorero/.npm/_logs/2023-03-14T14_50_47_686Z-debug-0.log

@@ -131,6 +131,9 @@ const getOsInfo = _.memoize(
}
);

// @ts-expect-error
// error TS2345: Argument of type '{}' is not assignable to parameter of type 'DriverOpts<Readonly<Record<string, Constraint>>>'
// Type '{}' is missing the following properties from type 'ServerArgs': address, allowCors, allowInsecure, basePath, and 26 more.
Copy link
Contributor Author

@rerorero rerorero Mar 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR just ignores the tsc error as a workaround but probably it'd be better to expose generateDriverLogPrefix function so it doesn't need to instantiate a BaseDriver

@rerorero rerorero marked this pull request as ready for review March 14, 2023 15:11
@mykola-mokhnach
Copy link
Contributor

Seems like tests still need some fixes

@rerorero
Copy link
Contributor Author

rebased with master branch and fixed the lint error

@mykola-mokhnach mykola-mokhnach merged commit 1e3014b into appium:master Mar 16, 2023
github-actions bot pushed a commit that referenced this pull request Mar 16, 2023
## [5.3.1](v5.3.0...v5.3.1) (2023-03-16)

### Bug Fixes

* install-npm.js fails to run npm run build due to type error ([#292](#292)) ([1e3014b](1e3014b))
* minBrowserVersion in SyncOption should be a number ([#291](#291)) ([39d8fdd](39d8fdd))

### Miscellaneous Chores

* ChromeDriver Bump to v111.0.5563.64 ([#290](#290)) ([2c4c144](2c4c144))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants