microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23.18k stars 1.45k forks source link

pnpm missing from path after updating #3616

Open sharunkumar opened 1 year ago

sharunkumar commented 1 year ago

Brief description of your issue

Updating pnpm when there is a new version available, removes pnpm from the PATH, so its no longer usable after the update, until the PC is restarted

Steps to reproduce

Install pnpm using winget after a new version is available, update pnpm using winget

Expected behavior

pnpm.exe should be available in PATH

Actual behavior

➜ winget list pnpm
Name Id        Version Source
------------------------------
pnpm pnpm.pnpm 8.7.5   winget
➜ where.exe pnpm
INFO: Could not find files for the given pattern(s).

Environment

Windows Package Manager v1.5.2201
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22621.2215
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.20.2201.0

Winget Directories
-------------------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
Portable Links Directory (User)    %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User)       %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root              C:\Program Files\WinGet\Packages
Portable Package Root (x86)        C:\Program Files (x86)\WinGet\Packages

Links
---------------------------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale

Admin Setting                             State
--------------------------------------------------
LocalManifestFiles                        Enabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Disabled
LocalArchiveMalwareScanOverride           Disabled
denelon commented 1 year ago

Unless the installer is doing something "interesting", you should just be able to close and reopen the terminal. Note: there is a difference between closing a tab in Windows Terminal and closing Windows Terminal. The latter is required to get a full environment variable refresh.

sharunkumar commented 1 year ago

Yes I have closed the terminal completely, but it seems like the PATH doesn't contain pnpm

I notice a similar issue when installing portable apps. The installation would succeed, but the binary wouldn't be available in PATH unless I do a system reboot

denelon commented 1 year ago

Do you have "Developer Mode" enabled or disabled? Did you install the portable application as a user or elevated in an administrator shell?

Clockwork-Muse commented 1 year ago

FWIW, I think some variation of this is affecting me with the Yuzu package (YuzuEmu.Yuzu.Mainline), which is also a portable install - it's supposed to add an entry to path so it's available on the command line, but the entry keeps disappearing (not present at all in the user account environment variables view, etc). Additionally, shortcuts or whatever is used to make the app findable on the start menu also disappear, meaning it's impossible to launch without manually searching through the relevant directories.

winget --info
Windows Package Manager v1.5.2201
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22621.2283
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.20.2201.0

Winget Directories
-------------------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
Portable Links Directory (User)    %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User)       %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root              C:\Program Files\WinGet\Packages
Portable Package Root (x86)        C:\Program Files (x86)\WinGet\Packages

Links
---------------------------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale

Admin Setting                             State
--------------------------------------------------
LocalManifestFiles                        Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Disabled
LocalArchiveMalwareScanOverride           Disabled

Do you have "Developer Mode" enabled or disabled? Did you install the portable application as a user or elevated in an administrator shell?

denelon commented 1 year ago

OK, if the install was performed via the user account (not in an elevated prompt) and the Developer Mode was disabled, then a symbolic link wouldn't have worked. WinGet would have directly added the path to the portable .exe to the "path" environment variable.

sharunkumar commented 1 year ago

Do you have "Developer Mode" enabled or disabled? Did you install the portable application as a user or elevated in an administrator shell?

Developer mode is not enabled and I installed using a user account (not elevated shell)

Should I update using an elevated shell for this to work as expected?

Clockwork-Muse commented 1 year ago

WinGet would have directly added the path to the portable .exe to the "path" environment variable.

It does, on install.

When I upgrade (via winget upgrade --all), the entry in path is removed.

zeratax commented 1 year ago

WinGet would have directly added the path to the portable .exe to the "path" environment variable.

It does, on install.

When I upgrade (via winget upgrade --all), the entry in path is removed.

this also seems to happen with yt-dlp and rufus? those are both gone now from my path and even reinstalling with --force doesn't seem to help.

josh-hemphill commented 5 months ago

Looks like it's a winget issue: https://github.com/microsoft/winget-cli/issues/4044