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

yarn pnp support #3586

brandonkal opened this issue Nov 26, 2019 · 11 comments

yarn pnp support #3586

brandonkal opened this issue Nov 26, 2019 · 11 comments


Copy link

On my machine, a kubernetes-typescript install takes:
200 seconds with a standard install
20 seconds with yarn PNP

First-class Yarn PNP support would be appreciated as it would mean much faster project startup time.


brandon@dev:~/pulumi-project/01-first$ pulumi up
Enter your passphrase to unlock config/secrets
    (set PULUMI_CONFIG_PASSPHRASE to remember): 
Previewing update (test):
     Type                 Name                 P
     pulumi:pulumi:Stack  pulumi-project-test   
  pulumi:pulumi:Stack (pulumi-project-test):
    error: It looks like the Pulumi SDK has not been installed. Have you run npm install or yarn install?
error: failed to load language plugin nodejs: could not read plugin [/home/brandon/.pulumi/bin/pulumi-language-nodejs] stdout: EOF


pulumi new kubernetes-typescript
mkdir 01-first && mv package.json 01-first/
mv index.ts 01-first/
echo 'config: .pulumi' >> Pulumi.yaml

Create a package.json

  "private": true,
  "workspaces": [
yarn policies set-version v2
yarn install
cd 01-first
pulumi stack init test

The tree should now look like this:

| |____index.ts
| |____package.json
| |____Pulumi.test.yaml
pulumi up
// logs error noted above
Copy link

pgavlin commented Nov 27, 2019

Interesting! This certainly sounds like a promising improvement.

Copy link

ringods commented Feb 26, 2020

A first stable version of Yarn 2 has been announced on 24 January 2020:

One of the biggest changes is that Plug'n'Play is enabled by default. You can expect that more and more people will start using it. I just tried it too, only to see it failing and eventually find this GH issue.

Looking at the Migration Guide, I think you do not need to support PnP specially. If Pulumi can detect a yarn enabled project (yarn.lock right?), it should launch yarn node rather than just node. I assume yarn will then detect whether the project has PnP enabled or not and calculate the correct NODE_PATH.

Copy link

ringods commented Feb 26, 2020

Looking at the NodeJS shim, I see some functionality assuming there is a node_modules folder.

This will make it a bit harder to get Yarn 2 support in I guess. 😕

Copy link

ringods commented Feb 26, 2020

For the people who already want to use the other nice features of Yarn 2, but don't be locked out due to PnP, you can still disable it. I found how to disable it in this StackOverflow answer:


nodeLinker: node-modules

Copy link

Just in case this helps anyone out and I appreciate it's only a stop-gap however yarn add @yarnpkg/pnpify -D and running pnpify pulumi up works for me 👍🏻

Copy link

Would adding an official template here help? When you create a project, you would run...

$ pulumi new typescript-pnp get a project skeleton using Yarn Berry PNP instead of NPM.

Supposing this was possible, WDYT? cc: @ringods and anyone who wants to chime in! :^D

Copy link

ringods commented Oct 21, 2022

@RobbieMcKinstry Yarn Berry PNP doesn't work at the moment. Some time ago, I tried to submit a PR but failed because there are so many places within the Pulumi CLI which expects a node_modules folder to be there: #4349

Copy link

Dang... I was hopeful there might be an expedient solution.

Copy link

RobbieMcKinstry commented Oct 24, 2022

Long term, I want us to decouple the SDKs from ecosystem tools.
For example, Python couples venv tightly, making it harder to use Poetry. Another example is TS-Node; it would useful to allow a different transpiler, like SWC or ESBuild, to be plugged in instead. We have open issues to track these tools individually, but I want to propose an epic to propose an approach to tackle the unifying theme.

Copy link

NexZhu commented Dec 7, 2022

Reporting the same problem for Pulumi project in a pnpm workspace, strangely it used to work before..

Copy link

Note to my fellow Pulumi maintainers: anyone coming back to this issue should start reading here. @ringods did a great job summarizing the state of the world and the core challenges faced in implementing pnp support.

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

No branches or pull requests

9 participants