Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When fnm is installed with winget, the symbolic link gets incorrect target if account contains character with accent #1182

Open
Attila-FIN opened this issue Jun 18, 2024 · 2 comments

Comments

@Attila-FIN
Copy link

Attila-FIN commented Jun 18, 2024

I've installed fnm with winget
winget install Schniz.fnm

However, after installation the execution was not possible.
Then I've found that in folder %LOCALAPPDATA%\Microsoft\WinGet\Links the link to fnm.exe had an incorrect target, since my account's folder includes an "á" character.

The solution was to re-create the link with:
New-Item -ItemType SymbolicLink -Path $env:LOCALAPPDATA -Name "\Microsoft\WinGet\Links\fnm.exe" -Value "$env:LOCALAPPDATA\Microsoft\WinGet\Packages\Schniz.fnm_Microsoft.Winget.Source_8wekyb3d8bbwe\fnm.exe"

However, after executing "fnm env", the result still includes the incorrect character and the resultant environment variables are wrong.

@Attila-FIN
Copy link
Author

The solution seems to be to add the following lines into the profile script (notepad $profile):

# Configure environment for Schniz.fnm

# Save the current encoding and switch to UTF-8.
$prev = [Console]::OutputEncoding
[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new()

fnm env --use-on-cd | Out-String | Invoke-Expression

# Restore the previous encoding.
[Console]::OutputEncoding = $prev

Perhaps the system wide setting could be also the solution, but I haven't tested that:
image

@GregoireBellon
Copy link

I had the exact same issue weeks ago, and it made me give up on fnm. Thanks to your fix, I could get it running.

This issue also affects nvm-windows, so if you happen to have an accent in your username, you simply can't have access to any node version manager on windows !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants