Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Add concurrency explanation -> FAQ #343

Merged
merged 2 commits into from
Sep 7, 2021
Merged

Conversation

jablko
Copy link
Contributor

@jablko jablko commented Aug 30, 2021

I ran into this issue here:

$ lerna run test-types
lerna notice cli v3.22.1
lerna info ci enabled
lerna info Executing command in 8 packages: "yarn run test-types"
lerna ERR! yarn run test-types exited 1 in '@mdx-js/react'
lerna ERR! yarn run test-types stdout:
$ dtslint types
Installing to /home/runner/.dts/typescript-installs/3.8...
Installed!

Installing to /home/runner/.dts/typescript-installs/4.0...
Installed!

Installing to /home/runner/.dts/typescript-installs/4.2...
Installed!

Installing to /home/runner/.dts/typescript-installs/4.3...
Installed!

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

lerna ERR! yarn run test-types stderr:
Error: Cannot find module '/home/runner/.dts/typescript-installs/4.5/node_modules/typescript'
Require stack:
- /home/runner/work/mdx/mdx/node_modules/dtslint/bin/lint.js
- /home/runner/work/mdx/mdx/node_modules/dtslint/bin/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at testDependencies (/home/runner/work/mdx/mdx/node_modules/dtslint/bin/lint.js:66:16)
    at /home/runner/work/mdx/mdx/node_modules/dtslint/bin/lint.js:26:28
    at Generator.next (<anonymous>)
    at /home/runner/work/mdx/mdx/node_modules/dtslint/bin/lint.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/runner/work/mdx/mdx/node_modules/dtslint/bin/lint.js:4:12)
error Command failed with exit code 1.

The failed invocation installed 3.8, 4.0, etc., a concurrent invocation installed 3.9, 4.5, etc. The failed invocation found the 4.5 directory but didn't wait for the 4.5 installation to complete and failed as a result (I surmise).

Solved with lerna --concurrency 1 run .... I suspect this is also the cause behind mdx-js/mdx#1172 and #267.

Fixes #267

@jablko jablko requested a review from sandersn as a code owner August 30, 2021 17:42
README.md Outdated
@@ -169,3 +169,5 @@ I'm getting an error about a missing typescript install.
Error: Cannot find module '/node_modules/dtslint/typescript-installs/3.1/node_modules/typescript`
```
Package lock files such as `yarn.lock` and `package-lock.json` may cause this issue because of our github dependency on `"definitelytyped-header-parser": "github:Microsoft/definitelytyped-header-parser#production"`, which contains the list of typescript versions to install. To fix this, try deleting your lock file and re-installing.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Package lock files such as yarn.lock and package-lock.json may cause this issue because of our github dependency on "definitelytyped-header-parser": "github:Microsoft/definitelytyped-header-parser#production", which contains the list of typescript versions to install. To fix this, try deleting your lock file and re-installing.

Separate topic but can this text be removed since 5e0f2e5, or #287?

Copy link
Member

Choose a reason for hiding this comment

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

I think you can still run into the problem, but the explanation should just be "Your dependencies may be out of date."

package-lock.json is checked into dtslint but not Definitely Typed, so maybe the solution can just be npm ci? But only if you're doing it from this repo and not Definitely Typed.

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Thanks for the update. What do you think about the suggested change to the previous line?

README.md Outdated
@@ -169,3 +169,5 @@ I'm getting an error about a missing typescript install.
Error: Cannot find module '/node_modules/dtslint/typescript-installs/3.1/node_modules/typescript`
```
Package lock files such as `yarn.lock` and `package-lock.json` may cause this issue because of our github dependency on `"definitelytyped-header-parser": "github:Microsoft/definitelytyped-header-parser#production"`, which contains the list of typescript versions to install. To fix this, try deleting your lock file and re-installing.
Copy link
Member

Choose a reason for hiding this comment

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

I think you can still run into the problem, but the explanation should just be "Your dependencies may be out of date."

package-lock.json is checked into dtslint but not Definitely Typed, so maybe the solution can just be npm ci? But only if you're doing it from this repo and not Definitely Typed.

@jablko
Copy link
Contributor Author

jablko commented Sep 7, 2021

Thanks for the update. What do you think about the suggested change to the previous line?

Sounds good 👍 I've updated that line.

This FAQ is to do with installing one list of TypeScript versions, and testing another, which can only happen if you end up with two different @definitelytyped/typescript-versions (I think). I haven't investigated the current dtslint/dtslint-runner/typescript-versions relationship to confirm how that could happen ...

I do vaguely recollect encountering this in the past ... There are child worker processes involved if I remember, so maybe somewhere in there the process doing the installing uses one node_modules and the one doing the testing uses another ...

@sandersn sandersn merged commit 274f0d0 into microsoft:master Sep 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot find module '/Users/JounQin/.dts/typescript-installs/next/node_modules/typescript'
2 participants