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

Turborepo doesn't work with pnpm v9 #8168

Closed
1 task done
ocavue opened this issue May 17, 2024 · 8 comments · Fixed by #8591
Closed
1 task done

Turborepo doesn't work with pnpm v9 #8168

ocavue opened this issue May 17, 2024 · 8 comments · Fixed by #8591
Assignees

Comments

@ocavue
Copy link

ocavue commented May 17, 2024

Verify canary release

  • I verified that the issue exists in the latest Turborepo canary release.

Link to code that reproduces this issue

https://github.com/issueset/turborepo-pnpm9-graph

What package manager are you using / does the bug impact?

pnpm

What operating system are you using?

Mac

Which canary version will you have in your reproduction?

turbo 1.13.4-canary.4

Describe the Bug

After I update pnpm from v8.15.8 to v9.1.1, turbo cannot create the dependency graph correctly, which causes the incorrect task executing order.

I first thought this is caused by the default configuration updates in pnpm v9.0. However, I updated .npmrc and reset all changed configuration to the same value as pnpm v8, turbo still doesn't work.

Expected Behavior

In my reproduction repo below, running pnpm turbo build --graph should print the same graph for pnpm v8 and v9.

To Reproduce

$ git clone https://github.com/issueset/turborepo-pnpm9-graph
$ cd turborepo-pnpm9-graph
$ pnpm --version
8.15.8
$ pnpm install
$ pnpm turbo build --graph

digraph {
	compound = "true"
	newrank = "true"
	subgraph "root" {
		"[root] @acme/core#build" -> "[root] @acme/eslint-config#build"
		"[root] @acme/core#build" -> "[root] @acme/tsconfig#build"
		"[root] @acme/docs#build" -> "[root] @acme/core#build"
		"[root] @acme/docs#build" -> "[root] @acme/eslint-config#build"
		"[root] @acme/docs#build" -> "[root] @acme/tsconfig#build"
		"[root] @acme/docs#build" -> "[root] @acme/utils#build"
		"[root] @acme/eslint-config#build" -> "[root] ___ROOT___"
		"[root] @acme/tsconfig#build" -> "[root] ___ROOT___"
		"[root] @acme/utils#build" -> "[root] @acme/eslint-config#build"
		"[root] @acme/utils#build" -> "[root] @acme/tsconfig#build"
	}
}

$ git checkout pnpm9
$ pnpm --version
9.1.1
$ pnpm install
$ pnpm turbo build --graph

digraph {
	compound = "true"
	newrank = "true"
	subgraph "root" {
		"[root] @acme/core#build" -> "[root] ___ROOT___"
		"[root] @acme/docs#build" -> "[root] ___ROOT___"
		"[root] @acme/eslint-config#build" -> "[root] ___ROOT___"
		"[root] @acme/tsconfig#build" -> "[root] ___ROOT___"
		"[root] @acme/utils#build" -> "[root] ___ROOT___"
	}
}

Additional context

No response

@ocavue ocavue added kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage owned-by: turborepo labels May 17, 2024
@anthonyshew
Copy link
Contributor

This was done in #7993 and will go out with next release.

(If you want to use it sooner, support is on the canary releases today.)

@ocavue
Copy link
Author

ocavue commented May 21, 2024

@anthonyshew I still can reproduce this issue with the latest v1.13.4-canary.5. I also found that turbo build --graph outputs different results after I run pnpm install again, which is weird. Here are the reproduce steps.

❯ git clone https://github.com/issueset/turborepo-pnpm9-graph

❯ cd turborepo-pnpm9-graph

❯ git checkout pnpm9-1.13.4-canary.5

❯ pnpm install
Scope: all 6 workspace projects
Lockfile is up to date, resolution step is skipped

devDependencies:
+ @acme/eslint-config 0.0.0 <- packages/eslint-config
+ @changesets/cli 2.27.2
+ eslint 8.57.0
+ prettier 3.2.5
+ turbo 1.13.4-canary.5

Done in 2.3s

❯ pnpm why turbo
Legend: production dependency, optional only, dev only

/private/tmp/turborepo-pnpm9-graph

devDependencies:
turbo 1.13.4-canary.5

❯ pnpm turbo build --graph

digraph {
	compound = "true"
	newrank = "true"
	subgraph "root" {
		"[root] @acme/core#build" -> "[root] @acme/eslint-config#build"
		"[root] @acme/core#build" -> "[root] @acme/tsconfig#build"
		"[root] @acme/docs#build" -> "[root] @acme/core#build"
		"[root] @acme/docs#build" -> "[root] @acme/eslint-config#build"
		"[root] @acme/docs#build" -> "[root] @acme/tsconfig#build"
		"[root] @acme/docs#build" -> "[root] @acme/utils#build"
		"[root] @acme/eslint-config#build" -> "[root] ___ROOT___"
		"[root] @acme/tsconfig#build" -> "[root] ___ROOT___"
		"[root] @acme/utils#build" -> "[root] @acme/eslint-config#build"
		"[root] @acme/utils#build" -> "[root] @acme/tsconfig#build"
	}
}


❯ pnpm install
Scope: all 6 workspace projects
Lockfile is up to date, resolution step is skipped
Already up to date
Done in 584ms

❯ pnpm turbo build --graph

digraph {
	compound = "true"
	newrank = "true"
	subgraph "root" {
		"[root] @acme/core#build" -> "[root] ___ROOT___"
		"[root] @acme/docs#build" -> "[root] ___ROOT___"
		"[root] @acme/eslint-config#build" -> "[root] ___ROOT___"
		"[root] @acme/tsconfig#build" -> "[root] ___ROOT___"
		"[root] @acme/utils#build" -> "[root] ___ROOT___"
	}
}

@anthonyshew
Copy link
Contributor

Will re-open so we don't forget to take another look.

@anthonyshew anthonyshew reopened this May 31, 2024
@masives
Copy link

masives commented Jun 5, 2024

had the same issue, upgrading to turbo@1.13.3 solved it for me as mentioned in #7993

@chris-olszewski chris-olszewski self-assigned this Jun 17, 2024
@chris-olszewski chris-olszewski removed the needs: triage New issues get this label. Remove it after triage label Jun 17, 2024
@chris-olszewski
Copy link
Member

chris-olszewski commented Jun 17, 2024

@ocavue

Can you make sure you rebuild your lockfile after the pnpm upgrade? I just tried your reproduction repo with 1.13.4 and got the correct graph:

[0 olszewski@chriss-mbp] /tmp/turborepo-pnpm9-graph $ turbo build --graph

digraph {
        compound = "true"
        newrank = "true"
        subgraph "root" {
                "[root] @acme/core#build" -> "[root] @acme/eslint-config#build"
                "[root] @acme/core#build" -> "[root] @acme/tsconfig#build"
                "[root] @acme/docs#build" -> "[root] @acme/core#build"
                "[root] @acme/docs#build" -> "[root] @acme/eslint-config#build"
                "[root] @acme/docs#build" -> "[root] @acme/tsconfig#build"
                "[root] @acme/docs#build" -> "[root] @acme/utils#build"
                "[root] @acme/eslint-config#build" -> "[root] ___ROOT___"
                "[root] @acme/tsconfig#build" -> "[root] ___ROOT___"
                "[root] @acme/utils#build" -> "[root] @acme/eslint-config#build"
                "[root] @acme/utils#build" -> "[root] @acme/tsconfig#build"
        }
}

[0 olszewski@chriss-mbp] /tmp/turborepo-pnpm9-graph $ pnpm --version
9.3.0
[0 olszewski@chriss-mbp] /tmp/turborepo-pnpm9-graph $ turbo --version
1.13.4

@ocavue
Copy link
Author

ocavue commented Jun 18, 2024

I can still reproduce this issue with the latest turbo@2.0.4. Here are the reproduce steps:

/tmp ❯ git clone https://github.com/issueset/turborepo-pnpm9-graph -b pnpm9-2.0.4 test-dir-1
Cloning into 'test-dir-1'...
remote: Enumerating objects: 123, done.
remote: Counting objects: 100% (123/123), done.
remote: Compressing objects: 100% (69/69), done.
remote: Total 123 (delta 52), reused 116 (delta 45), pack-reused 0
Receiving objects: 100% (123/123), 176.74 KiB | 512.00 KiB/s, done.
Resolving deltas: 100% (52/52), done.

/tmp ❯ cd test-dir-1

/tmp/test-dir-1 pnpm9-2.0.4 ❯ pnpm --version
9.4.0

/tmp/test-dir-1 pnpm9-2.0.4 ❯ pnpm install
Scope: all 6 workspace projects
Lockfile is up to date, resolution step is skipped
Packages: +600
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 600, reused 599, downloaded 0, added 600, done

devDependencies:
+ @acme/eslint-config 0.0.0 <- packages/eslint-config
+ @changesets/cli 2.27.5
+ eslint 8.57.0
+ prettier 3.3.2
+ turbo 2.0.4

Done in 2.6s

/tmp/test-dir-1 pnpm9-2.0.4 ❯ pnpm why turbo
Legend: production dependency, optional only, dev only

turborepo-pnpm9-graph /private/tmp/test-dir-1

devDependencies:
turbo 2.0.4

/tmp/test-dir-1 pnpm9-2.0.4 ❯ pnpm turbo build --graph --log-order grouped

digraph {
	compound = "true"
	newrank = "true"
	subgraph "root" {
		"[root] @acme/core#build" -> "[root] ___ROOT___"
		"[root] @acme/docs#build" -> "[root] ___ROOT___"
		"[root] @acme/eslint-config#build" -> "[root] ___ROOT___"
		"[root] @acme/tsconfig#build" -> "[root] ___ROOT___"
		"[root] @acme/utils#build" -> "[root] ___ROOT___"
	}
}


/tmp/test-dir-1 pnpm9-2.0.4 ❯

I tried clean pnpm-lock.yaml but it doesn't work:

/tmp ❯ git clone https://github.com/issueset/turborepo-pnpm9-graph -b pnpm9-2.0.4 test-dir-2
Cloning into 'test-dir-2'...
remote: Enumerating objects: 123, done.
remote: Counting objects: 100% (123/123), done.
remote: Compressing objects: 100% (69/69), done.
remote: Total 123 (delta 52), reused 116 (delta 45), pack-reused 0
Receiving objects: 100% (123/123), 176.74 KiB | 514.00 KiB/s, done.
Resolving deltas: 100% (52/52), done.

/tmp ❯ cd test-dir-2

/tmp/test-dir-2 pnpm9-2.0.4 ❯ pnpm --version
9.4.0

/tmp/test-dir-2 pnpm9-2.0.4 ❯ rm -rf pnpm-lock.yaml

/tmp/test-dir-2 pnpm9-2.0.4 !1 ❯ pnpm install
Scope: all 6 workspace projects
 WARN  5 deprecated subdependencies found: @humanwhocodes/config-array@0.11.14, @humanwhocodes/object-schema@2.0.3, glob@7.2.3, inflight@1.0.6, rimraf@3.0.2
Packages: +600
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 649, reused 599, downloaded 0, added 600, done

devDependencies:
+ @acme/eslint-config 0.0.0 <- packages/eslint-config
+ @changesets/cli 2.27.5
+ eslint 8.57.0 (9.5.0 is available)
+ prettier 3.3.2
+ turbo 2.0.4

Done in 11.2s

/tmp/test-dir-2 pnpm9-2.0.4 11s ❯ pnpm turbo build --graph --log-order grouped

digraph {
	compound = "true"
	newrank = "true"
	subgraph "root" {
		"[root] @acme/core#build" -> "[root] ___ROOT___"
		"[root] @acme/docs#build" -> "[root] ___ROOT___"
		"[root] @acme/eslint-config#build" -> "[root] ___ROOT___"
		"[root] @acme/tsconfig#build" -> "[root] ___ROOT___"
		"[root] @acme/utils#build" -> "[root] ___ROOT___"
	}
}


/tmp/test-dir-2 pnpm9-2.0.4 ❯

fwouts added a commit to fwouts/previewjs that referenced this issue Jun 23, 2024
Local dependencies weren't detected, so something as simple as `turbo build` would explode.

See vercel/turbo#8168.
@igloo1505
Copy link

I can still reproduce this issue with the latest turbo@2.0.4. Here are the reproduce steps:

/tmp ❯ git clone https://github.com/issueset/turborepo-pnpm9-graph -b pnpm9-2.0.4 test-dir-1
Cloning into 'test-dir-1'...
remote: Enumerating objects: 123, done.
remote: Counting objects: 100% (123/123), done.
remote: Compressing objects: 100% (69/69), done.
remote: Total 123 (delta 52), reused 116 (delta 45), pack-reused 0
Receiving objects: 100% (123/123), 176.74 KiB | 512.00 KiB/s, done.
Resolving deltas: 100% (52/52), done.

/tmp ❯ cd test-dir-1

/tmp/test-dir-1 pnpm9-2.0.4 ❯ pnpm --version
9.4.0

/tmp/test-dir-1 pnpm9-2.0.4 ❯ pnpm install
Scope: all 6 workspace projects
Lockfile is up to date, resolution step is skipped
Packages: +600
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 600, reused 599, downloaded 0, added 600, done

devDependencies:
+ @acme/eslint-config 0.0.0 <- packages/eslint-config
+ @changesets/cli 2.27.5
+ eslint 8.57.0
+ prettier 3.3.2
+ turbo 2.0.4

Done in 2.6s

/tmp/test-dir-1 pnpm9-2.0.4 ❯ pnpm why turbo
Legend: production dependency, optional only, dev only

turborepo-pnpm9-graph /private/tmp/test-dir-1

devDependencies:
turbo 2.0.4

/tmp/test-dir-1 pnpm9-2.0.4 ❯ pnpm turbo build --graph --log-order grouped

digraph {
	compound = "true"
	newrank = "true"
	subgraph "root" {
		"[root] @acme/core#build" -> "[root] ___ROOT___"
		"[root] @acme/docs#build" -> "[root] ___ROOT___"
		"[root] @acme/eslint-config#build" -> "[root] ___ROOT___"
		"[root] @acme/tsconfig#build" -> "[root] ___ROOT___"
		"[root] @acme/utils#build" -> "[root] ___ROOT___"
	}
}


/tmp/test-dir-1 pnpm9-2.0.4 ❯

I tried clean pnpm-lock.yaml but it doesn't work:

/tmp ❯ git clone https://github.com/issueset/turborepo-pnpm9-graph -b pnpm9-2.0.4 test-dir-2
Cloning into 'test-dir-2'...
remote: Enumerating objects: 123, done.
remote: Counting objects: 100% (123/123), done.
remote: Compressing objects: 100% (69/69), done.
remote: Total 123 (delta 52), reused 116 (delta 45), pack-reused 0
Receiving objects: 100% (123/123), 176.74 KiB | 514.00 KiB/s, done.
Resolving deltas: 100% (52/52), done.

/tmp ❯ cd test-dir-2

/tmp/test-dir-2 pnpm9-2.0.4 ❯ pnpm --version
9.4.0

/tmp/test-dir-2 pnpm9-2.0.4 ❯ rm -rf pnpm-lock.yaml

/tmp/test-dir-2 pnpm9-2.0.4 !1 ❯ pnpm install
Scope: all 6 workspace projects
 WARN  5 deprecated subdependencies found: @humanwhocodes/config-array@0.11.14, @humanwhocodes/object-schema@2.0.3, glob@7.2.3, inflight@1.0.6, rimraf@3.0.2
Packages: +600
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 649, reused 599, downloaded 0, added 600, done

devDependencies:
+ @acme/eslint-config 0.0.0 <- packages/eslint-config
+ @changesets/cli 2.27.5
+ eslint 8.57.0 (9.5.0 is available)
+ prettier 3.3.2
+ turbo 2.0.4

Done in 11.2s

/tmp/test-dir-2 pnpm9-2.0.4 11s ❯ pnpm turbo build --graph --log-order grouped

digraph {
	compound = "true"
	newrank = "true"
	subgraph "root" {
		"[root] @acme/core#build" -> "[root] ___ROOT___"
		"[root] @acme/docs#build" -> "[root] ___ROOT___"
		"[root] @acme/eslint-config#build" -> "[root] ___ROOT___"
		"[root] @acme/tsconfig#build" -> "[root] ___ROOT___"
		"[root] @acme/utils#build" -> "[root] ___ROOT___"
	}
}


/tmp/test-dir-2 pnpm9-2.0.4 ❯

Did you ever get this resolved? Going back to pnpm@8.15.8 causes all sorts of new issues as well, which might be specific to my dependencies, I'm not real sure. Everything was working with pnpm@9.0.4 until I didn't deploy any updates for about a week, and all of a sudden the builds fail without any new dependencies or changes to pnpm or Next configs. This is indescribably frustrating.

@chris-olszewski
Copy link
Member

I believe this has been fixed in 2.0.6-canary.0 please try it out and reopen if the issue persists.

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

Successfully merging a pull request may close this issue.

5 participants