extension fails with yarn2
See original GitHub issueSummary
I use yarn2 to install dependencies
Github Repository to Reproduce Issue
repo is private
Steps To Reproduce:
- setup yarn2
- setup all dependencies for the project
yarn install
- open any file of the project in vs code with prettier extension
Expected result
usual behaviour as it was on prior version of yarn
Actual result
Error: Failed to load module. If you have prettier or plugins referenced in package.json, ensure you have run npm install
Attempted to load prettier from package.json
Sourse: Prettier - Code Formatter [extension]
Additional information
VS Code Version: 1.41.1
Prettier Extension Version: 3.18.0
OS and version: MacOS 10.15.2 (19C57)
Prettier Log Output
["ERROR" - 11:02:41 PM] Failed to load prettier from ''**Censored**
Cannot find module 'prettier' from '/Users/**Censored**/projects/**Censored**/**Censored**/package.json'
Error: Cannot find module 'prettier' from '/Users/**Censored**/projects/**Censored**/**Censored**/package.json'
at Function.e.exports [as sync] (/Users/**Censored**/.vscode/extensions/esbenp.prettier-vscode-3.18.0/dist/extension.js:1:319843)
at t.ModuleResolver.findPkg (/Users/**Censored**/.vscode/extensions/esbenp.prettier-vscode-3.18.0/dist/extension.js:1:246852)
at t.ModuleResolver.findPkg [as findPkgMem] (/Users/**Censored**/.vscode/extensions/esbenp.prettier-vscode-3.18.0/dist/extension.js:1:247210)
at t.ModuleResolver.requireLocalPkg (/Users/**Censored**/.vscode/extensions/esbenp.prettier-vscode-3.18.0/dist/extension.js:1:245330)
at t.ModuleResolver.getPrettierInstance (/Users/**Censored**/.vscode/extensions/esbenp.prettier-vscode-3.18.0/dist/extension.js:1:243969)
at t.LanguageResolver.getSupportLanguages (/Users/**Censored**/.vscode/extensions/esbenp.prettier-vscode-3.18.0/dist/extension.js:1:242420)
at t.LanguageResolver.allEnabledLanguages (/Users/**Censored**/.vscode/extensions/esbenp.prettier-vscode-3.18.0/dist/extension.js:1:242028)
at t.StatusBarService.toggleStatusBarItem (/Users/**Censored**/.vscode/extensions/esbenp.prettier-vscode-3.18.0/dist/extension.js:1:85577)
at /Users/**Censored**/.vscode/extensions/esbenp.prettier-vscode-3.18.0/dist/extension.js:1:85250
at l.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:46:893)
at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:641:245
at l.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:46:893)
at f.$acceptDocumentsAndEditorsDelta (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:561:804)
at p._doInvokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:663:275)
at p._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:662:971)
at p._receiveRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:661:639)
at p._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:660:468)
at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:658:691
at l.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:46:893)
at _.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:189:274)
at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:820:285
at l.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:46:893)
at _.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:189:274)
at t.PersistentProtocol._receiveMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:193:629)
at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:190:824
at l.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:46:893)
at p.acceptChunk (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:186:737)
at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:186:89
at Socket.t (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:195:68)
at Socket.emit (events.js:200:13)
at addChunk (_stream_readable.js:294:12)
at readableAddChunk (_stream_readable.js:275:11)
at Socket.Readable.push (_stream_readable.js:210:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:166:17)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:15
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Error Codes | Yarn - Package Manager
This usually occurs in only two cases: either the package never has been built before, or its previous build failed (returned a non-zero...
Read more >How to configure VSCode to run Yarn 2 (with PnP) powered ...
I had this problem last night while migrating to Yarn v2 and using PnP. Make sure that after running yarn dlx @yarnpkg/sdks vscode...
Read more >242936 – editors/vscode: Fails to build: yarn attempts to fetch ...
Hi, On an 12.1 AMD64 box, I am trying to build editors/vscode from ports with all default config options on.
Read more >Yarn Install fails with ESOCKETTIMEDOUT for few npm ...
error An unexpected error occurred: "https://registry.yarnpkg.com/@fluentui ... We have determined that this issue belongs to Geek Learning's Yarn extension ...
Read more >Yarn build fails in deployment - [@roots/bud-preset-wordpress ...
Running into an issue running yarn build when deploying a new Sage 10 site ... made-beanies/node_modules/@roots/bud-preset-wordpress/lib/extension.js:10:57) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ntotten the problem here is that even when setting the vscode setting ;
(As done automatically by following https://yarnpkg.com/advanced/editor-sdks )
It looks like the plugins still tries to load the version from
package.json
first instead of the explicitly configured path.For now, you will have to set the prettier path. This is probably going to be a fairly large investment to fix due to how yarn2 has changed dependency resolution. I will try to look into it soon, but if somebody has expertise with yarn2 a PR would be welcome.