Yarn PnP SDK shows several "@yarnpkg/pnpify" errors
borekb opened this issue ยท 5 comments
Summary
I use the Yarn PnP version of the "SDK" (.yarn/sdks/prettier/index.js
) and am getting several of these errors when loading Prettier in VSCode:
Your application tried to access @yarnpkg/pnpify, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.
Steps To Reproduce:
- Install Yarn PnP SDKs:
dlx @yarnpkg/pnpify --sdk vscode
- Use this in
settings.json
:"prettier.prettierPath": ".yarn/sdks/prettier/index.js"
- Load VSCode
Expected result
Everything starts cleanly.
Actual result
The Output panel contains this:
["INFO" - 1:15:31 PM] Extension Name: esbenp.prettier-vscode.
["INFO" - 1:15:31 PM] Extension Version: 6.2.0.
["ERROR" - 1:15:31 PM] Error loading node module '/Users/borekb/prettier-demo/.yarn/sdks/prettier/index.js'
["ERROR" - 1:15:31 PM] Your application tried to access @yarnpkg/pnpify, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.
Required package: @yarnpkg/pnpify (via "@yarnpkg/pnpify")
Required by: /Users/borekb/prettier-demo/
Require stack:
- /Users/borekb/prettier-demo/.yarn/sdks/prettier/index.js
- /Users/borekb/.vscode/extensions/esbenp.prettier-vscode-6.2.0/dist/extension.js
- /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js
- /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js
- /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork.js
Error: Your application tried to access @yarnpkg/pnpify, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.
Required package: @yarnpkg/pnpify (via "@yarnpkg/pnpify")
Required by: /Users/borekb/prettier-demo/
Require stack:
- /Users/borekb/prettier-demo/.yarn/sdks/prettier/index.js
- /Users/borekb/.vscode/extensions/esbenp.prettier-vscode-6.2.0/dist/extension.js
- /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js
- /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js
- /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork.js
at internalTools_makeError (/Users/borekb/prettier-demo/.pnp.js:9920:34)
at resolveToUnqualified (/Users/borekb/prettier-demo/.pnp.js:10879:23)
at resolveRequest (/Users/borekb/prettier-demo/.pnp.js:10977:29)
at Object.resolveRequest (/Users/borekb/prettier-demo/.pnp.js:11055:26)
at Function.external_module_.Module._resolveFilename (/Users/borekb/prettier-demo/.pnp.js:10153:34)
at Function.v.resolve (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:3:12349)
at Object.<anonymous> (/Users/borekb/prettier-demo/.yarn/sdks/prettier/index.js:18:36)
at Module.u._compile (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:3:12841)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1039:32)
at Module._load (internal/modules/cjs/loader.js:932:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12738)
at Function.s._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:106:27167)
at Function._._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:106:23919)
at Function.W._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:96:4637)
at Module.require (internal/modules/cjs/loader.js:1079:19)
at Module.patchedRequire [as require] (/Users/borekb/.vscode/extensions/ryu1kn.partial-diff-1.4.1/node_modules/diagnostic-channel/dist/src/patchRequire.js:14:46)
at v (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:3:12287)
at t.ModuleResolver.loadNodeModule (/Users/borekb/.vscode/extensions/esbenp.prettier-vscode-6.2.0/src/ModuleResolver.ts:308:9)
at t.ModuleResolver.<anonymous> (/Users/borekb/.vscode/extensions/esbenp.prettier-vscode-6.2.0/src/ModuleResolver.ts:188:11)
at Generator.next (<anonymous>)
at s (/Users/borekb/.vscode/extensions/esbenp.prettier-vscode-6.2.0/dist/extension.js:1:2695)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Formatting seems to work but the Output panel is full of these errors.
Additional information
VS Code Version: 1.54.2
Prettier Extension Version: 6.2.0
OS and version: macOS Big Sur (Darwin x64 20.3.0)
Can you publish the source or a small example to reproduce?
@ntotten Here's the repro: https://github.com/borekb/prettier-vscode-1844
This is expected, the sdk uses @yarnpkg/pnpify
to allow prettier
to scan node_modules
for plugins, you need to add @yarnpkg/pnpify
to your dependencies or remove that part of the sdk if you don't need it
I have confirmed in borekb/prettier-vscode-1844#1, thanks a lot @merceyz!
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.