microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.95k stars 29.53k forks source link

Integrated terminal can't see global npm packages #234978

Open d0rich opened 1 day ago

d0rich commented 1 day ago

Type: Bug

I can't run any globally installed npm packages (like yarn) in the vscode integrated powershell terminal. That's also a reason why all my attempts to run npm scripts from the package.json fail.

Every time this error:

yarn : The term 'yarn' is not recognized as the name of a cmdlet, function, script file, or operable progr
am. Check the spelling of the name, or if a path was included, verify that the path is correct and try aga
in.
At line:1 char:1
+ yarn --version
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (yarn:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

The most interesting part: if I try to do the same somewhere outside of vscode (eg windows terminal), it works fine. Additionally, an hour ago yarn worked inside vscode, and I don't remember anything, that could affect it.

VS Code version: Code 1.95.3 (f1a4fb101478ce6ec82fe9627c43efbf9e98c813, 2024-11-13T14:50:04.152Z) OS version: Windows_NT x64 10.0.26100 Modes:

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 7 7840HS with Radeon 780M Graphics (16 x 3793)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off| |Load (avg)|undefined| |Memory (System)|15.19GB (4.56GB free)| |Process Argv|--crash-reporter-id a4c9f7ee-a0f4-4ab3-9046-9656fcfb8b7e| |Screen Reader|no| |VM|0%|
Extensions (51) Extension|Author (truncated)|Version ---|---|--- vscode-sqlite|ale|0.14.1 iconify|ant|0.10.2 markdown-mermaid|bie|1.27.0 mermaid-markdown-syntax-highlighting|bpr|1.7.0 vscode-tailwindcss|bra|0.12.15 npm-intellisense|chr|1.4.5 gitlens|eam|16.0.4 vscode-html-css|ecm|2.0.11 EditorConfig|Edi|0.16.4 prettier-vscode|esb|11.0.0 auto-close-tag|for|0.5.15 auto-rename-tag|for|0.1.10 copilot|Git|1.246.0 copilot-chat|Git|0.22.4 remotehub|Git|0.64.0 vscode-github-actions|git|0.27.0 vscode-pull-request-github|Git|0.100.3 gitlab-workflow|Git|5.19.0 todo-tree|Gru|0.0.226 npm-dependency-links|her|1.2.0 discord-vscode|icr|5.8.0 openvpn|idl|0.3.5 plantuml|jeb|2.18.1 svg|joc|1.5.4 intellij-idea-keybindings|k--|1.7.3 rainbow-csv|mec|3.13.0 xml-format|mik|1.1.3 dotenv|mik|1.0.1 vscode-docker|ms-|1.29.3 remote-ssh|ms-|0.115.1 remote-ssh-edit|ms-|0.87.0 remote-wsl|ms-|0.88.5 azure-repos|ms-|0.40.0 remote-explorer|ms-|0.4.3 remote-repositories|ms-|0.42.0 vsliveshare|ms-|1.0.5941 mdc|Nux|0.2.0 prisma|Pri|6.0.0 vscode-thunder-client|ran|2.32.2 LiveServer|rit|5.7.9 icons|tal|3.8.0 even-better-toml|tam|0.19.2 pdf|tom|1.2.2 func-vscode|ton|1.1.7 vscode-icons|vsc|12.9.0 vscode-mermaid-preview|vst|1.6.3 volar|Vue|2.1.10 vscode-todo-highlight|way|1.0.5 eno|Wsc|2.3.53 markdown-all-in-one|yzh|3.6.2 material-theme|zhu|3.17.6
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 pythonvspyt551:31179978 vscod805cf:30301675 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 2i9eh265:30646982 962ge761:30959799 pythonnoceb:30805159 asynctok:30898717 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 dvdeprecation:31068756 dwnewjupytercf:31046870 nativerepl2:31139839 pythonrstrctxt:31112756 nativeloc1:31185841 cf971741:31144450 iacca1:31171482 notype1cf:31157160 5fd0e150:31155592 dwcopilot:31170013 stablechunks:31184530 ```
d0rich commented 1 day ago

Update: it was somehow solved itself, but it still would be nice to know how to act in such situations