Describe the bug
After updating yarn to the latest version and clearing .vscode/pnpify folder I tried to reinstall sdk for vscode and got error that this tool can only be used with projects using yarn pnp.
/private/var/folders/93/vgsdsk_104nbjj6z2xmn0g6m0000gn/T/xfs-4d5fc4c3/dlx-47110/.yarn/$$virtual/@yarnpkg-pnpify-virtual-4f1a43ab06/9/Users/osiyuk/Library/yarn/berry/cache/@yarnpkg-pnpify-npm-2.0.0-rc.23-41dbaf591b-4.zip/node_modules/@yarnpkg/pnpify/lib/cli.js:46
throw new Error(`This tool can only be used with projects using Yarn Plug'n'Play`);
^
Error: This tool can only be used with projects using Yarn Plug'n'Play
at sdk (/private/var/folders/93/vgsdsk_104nbjj6z2xmn0g6m0000gn/T/xfs-4d5fc4c3/dlx-47110/.yarn/$$virtual/@yarnpkg-pnpify-virtual-4f1a43ab06/9/Users/osiyuk/Library/yarn/berry/cache/@yarnpkg-pnpify-npm-2.0.0-rc.23-41dbaf591b-4.zip/node_modules/@yarnpkg/pnpify/lib/cli.js:46:15)
at Object.<anonymous> (/private/var/folders/93/vgsdsk_104nbjj6z2xmn0g6m0000gn/T/xfs-4d5fc4c3/dlx-47110/.yarn/$$virtual/@yarnpkg-pnpify-virtual-4f1a43ab06/9/Users/osiyuk/Library/yarn/berry/cache/@yarnpkg-pnpify-npm-2.0.0-rc.23-41dbaf591b-4.zip/node_modules/@yarnpkg/pnpify/lib/cli.js:17:5)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.external_module_.Module._load (/private/var/folders/93/vgsdsk_104nbjj6z2xmn0g6m0000gn/T/xfs-4d5fc4c3/dlx-47110/.pnp.js:9750:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
To Reproduce
It works in empty folder:
yarn set version berry
yarn dlx @yarnpkg/pnpify --sdk vscode
Environment if relevant (please complete the following information):
The latest release doesn't include the latest changes which were merged only 2 days ago. Unfortunately, right now, the documentation always points to the latest changes on master. I'll see if there's anything we can do about it.
So, to answer your question:
rc.34, you have to do yarn pnpify --sdk (without arguments, here the vscode is interpreted as the CWD instead of a supported editor)master, you have to do yarn pnpify --sdk vscode@paul-soporan yarn pnpify --sdk works (if @yarnpkg/pnpify is installed locally), thanks.
I tried to build yarn from sources yarn set version from sources and try yarn pnpify --sdk vscode, but I still get the same error, tho without vscode it works.
yarn --version return 2.0.0-rc.34.git.20200611.7de6413a
I tried to build yarn from sources yarn set version from sources and try yarn pnpify --sdk vscode, but I still get the same error, tho without vscode it works.
That's expected, yarn set version from sources only builds the bundle from sources. @yarnpkg/pnpify isn't part of the bundle, but a regular package that you have to install from the registry.
If you want to install PnPify from sources, you have to do:
$ yarn add @yarnpkg/pnpify@yarnpkg/berry#workspace=@yarnpkg/pnpify
This will install the latest @yarnpkg/pnpify right from our repo. Note: This won't work on Windows unless you have rsync installed, since our build scripts use it.