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

[Bug]: tsp install breaks on latest version of node #3242

Closed
4 tasks done
LadyCailin opened this issue Apr 26, 2024 · 2 comments · Fixed by #3243
Closed
4 tasks done

[Bug]: tsp install breaks on latest version of node #3242

LadyCailin opened this issue Apr 26, 2024 · 2 comments · Fixed by #3243
Labels
bug Something isn't working needs-area

Comments

@LadyCailin
Copy link
Contributor

LadyCailin commented Apr 26, 2024

Describe the bug

> node --version
v20.12.2
> tsp install
TypeSpec compiler v0.53.1

tsp install

Install TypeSpec dependencies

Options:
  --help     Show help                                                 [boolean]
  --debug    Output debug log messages.               [boolean] [default: false]
  --pretty   Enable color and formatting in TypeSpec's output to make compiler e
             rrors easier to read.                     [boolean] [default: true]
  --version  Show version number                                       [boolean]

Error: spawn EINVAL
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at spawn (node:child_process:761:9)
    at installTypeSpecDependencies (file:///C:/Users/.../node_modules/@typespec/compiler/dist/src/core/install.js:4:19)
    at file:///C:/Users/.../node_modules/@typespec/compiler/dist/src/core/cli/cli.js:157:95
    at Object.handler (file:///C:/Users/.../node_modules/@typespec/compiler/dist/src/core/cli/utils.js:16:16)
    at file:///C:/Users/caismith/.../node_modules/yargs/build/lib/command.js:206:54
    at maybeAsyncResult (file:///C:/Users/.../node_modules/yargs/build/lib/utils/maybe-async-result.js:9:15)
    at CommandInstance.handleValidationAndGetResult (file:///C:/Users/.../node_modules/yargs/build/lib/command.js:205:25)
    at CommandInstance.applyMiddlewareAndGetResult (file:///C:/Users/.../node_modules/yargs/build/lib/command.js:245:20)
    at CommandInstance.runCommand (file:///C:/Users/.../node_modules/yargs/build/lib/command.js:128:20) {
  errno: -4071,
  code: 'EINVAL',
  syscall: 'spawn'
}

According to nodejs/node#52554 this is an security fix in the latest version of node.

Reproduction

  1. Download NodeJS Version v18.20.2, v20.12.2, v21.7.3
  2. Run tsp install

Checklist

@LadyCailin LadyCailin added the bug Something isn't working label Apr 26, 2024
LadyCailin added a commit to LadyCailin/typespec that referenced this issue Apr 26, 2024
This is a breakage due to a breaking change in node's latest incremental version.
(See nodejs/node#52554 for background). Addint
shell: true fixes this.

Fixes microsoft#3242.
@LadyCailin
Copy link
Contributor Author

LadyCailin commented Apr 26, 2024

There are a couple of other places that this is probably also broken, but I have not traced the code enough to test it: legacy-helper.js, utils.js, and common.ts, as well as some test files. legacy-helper.js specifically mentions this being intentionally not used because "it causes other issues". However, tsp install is probably the most urgent of these fixes.

@timotheeguerin
Copy link
Member

yeah we especially were not calling shell: true and having hardcoded mapping of the windows vs linux executable name to we wouldn't have to deal with escaping parameters. I'll investigate if there is a better way or we will need to do that

github-merge-queue bot pushed a commit that referenced this issue Apr 26, 2024
This is a breakage due to a breaking change in node's latest incremental
version. (See nodejs/node#52554 for
background). Adding shell: true fixes this.

Fixes #3242.

---------

Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-area
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants