Open liiiiiiiiiiiir opened 6 months ago
it says fnm is not available. Maybe the initialization happens before cargo is added to PATH?
it says fnm is not available. Maybe the initialization happens before cargo is added to PATH?
nonono, I installed the cargo first, and then I ran cargo install fnm
it says fnm is not available. Maybe the initialization happens before cargo is added to PATH?
Hello, this error has been resolved. When there is Chinese in the environment variable, fnm env --use-on-cd
will output garbled results. I'm sorry about this. So I was wondering if it's possible to add a option to set encoding format. And I just tested Chinese, I don't know if other non English languages have this problem
Can you please attach the output you get? So we can escape it properly 🙏
Can you please attach the output you get? So we can escape it properly 🙏 When fnm is installed on the C drive, it will output the following information when used
Afterwards, I moved FNM to the full English path, and there was no problem using FNM, but the installation path of the node still had garbled characters The folder below is a directory automatically created by FNM when downloading nodes due to garbled characters
Hey.
Similar issue here, almost opened a new ticket.
For me, my userprofile directory on windows contains the letter 'á': C:\Users\Konrád.
I installed fnm using winget and powershell, and the results were pretty bad.
winget install Schniz.fnm
...
Successfully installed
To the environment variables it added
C:\Users\Konrád\AppData\Local\Microsoft\WinGet\Packages\Schniz.fnm_Microsoft.Winget.Source_8wekyb3d8bbwe
After fixing it manually I reloaded the path
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
Then installed node
fnm install 20
This created the node installation under a new user folder:
C:\Users\KonrÔöť├şd\AppData\Roaming\fnm
Then I tried playing around a bit more:
PS C:\Projects\t90dct\t90dct-stats\frontend> fnm install 20
Installing Node v20.12.2 (x64)
warning: Version already installed at "C:\\Users\\KonrÔöť├şd\\AppData\\Roaming\\fnm\\node-versions\\v20.12.2"
PS C:\Projects\t90dct\t90dct-stats\frontend> fnm env --use-on-cd | Out-String | Invoke-Expression
fnm:
Line |
10 | function global:Set-FnmOnLoad { fnm use --silent-if-unchanged }
| ~~~
| The term 'fnm' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
PS C:\Projects\t90dct\t90dct-stats\frontend> fnm env --use-on-cd | Out-String | Invoke-Expression
fnm: The term 'fnm' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
PS C:\Projects\t90dct\t90dct-stats\frontend> winget
winget: The term 'winget' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
After trying fnm env, it kinda killed my PATH as it is, and I had to reload it. Trying to use fnm env from the startup powershell script results in the same error.
I then tried using it from a terminal with administrator priviliges just to see what would happen. After installing fnm there and trying to fnm use
it, and fnm env ...
I now have 2 more folders where they should not be:
C:\Users\Konrád\AppData\Local\fnm_multishells
C:\Users\Konr├ö├Â┼ąÔöť┼čd\AppData\Roaming\fnm
So yeah... it is kind of broken, not only with chinese characters. Probably something something windows' own character encoding messing with stuff.
I haven’t used windows in almost 10 years. Would be great to get your assistance in what needs to change in the fnm env output 🙏
Sadly fnm env's output does not seem to be the only thing broken. I tried uninstalling via winget and that also failed. The env variable path that was set was also incorrect. It's probably the handling of the OS path strings in general that's the problem.
That said in the fnm env case specifically this line is to blame:
$env:FNM_DIR = "C:\Users\Konr├ö├Â┼ąÔöť┼čd\AppData\Roaming\fnm"
My rust and knowledge on character encodings are far from anywhere close to even understand what needs to be changed, but I'll take a look when my time permits.
Edit: Also I just noticed that some \fnm_multishells
directories were created in the correct place, making me even more confused
Hi, bumping on this issue as it is recent and seems related, but I'm getting some similar issues with this. It definitely was working on windows as I've successfully used it previously, but it now isn't. When trying the install step in PowerShell I get:
PS C:\> fnm env --use-on-cd | Out-String | Invoke-Expression
fnm : error: Can't infer shell!
At line:1 char:1
+ fnm env --use-on-cd | Out-String | Invoke-Expression
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (error: Can't infer shell!:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
* cmd
Invoke-Expression : Cannot bind argument to parameter 'Command' because it is an empty string.
At line:1 char:36
+ fnm env --use-on-cd | Out-String | Invoke-Expression
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:PSObject) [Invoke-Expression], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.InvokeExpressionCo
mmand
Just further on this - the line
fnm env --use-on-cd | Out-String | Invoke-Expression
has been added to the profile, which is in the correct location...
What fnm version are you on?
Hi Gal 1.37.1
Ralph
On 05/07/2024 20:34, Gal Schlezinger wrote:
What fnm version are you on?
-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you commented.Message ID: @.***>
[1] https://github.com/Schniz/fnm/issues/1110#issuecomment-2211326398 [2] https://github.com/notifications/unsubscribe-auth/AOO4TCTDGI3HXKAKG7FGB2LZK3YLZAVCNFSM6AAAAABGRIBCDCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJRGMZDMMZZHA
interesting. would be great to understand what is special about your setup. i have some tests and i need to know how to repro 🙏
Same problem for me -___- and its the same with the special characters.
My username on my pc has a ü. The path winget made changed it to Ã1⁄4 and changing the path manually made it so I can run fnm. I will update here again if I run into more problems.
If I can help with anything eg. setting up to repro then I will gladly help ^^
Edit 1 Yep another thing isnt working. something seems to be up with running -> fnm env --use-on-cd | Out-String | Invoke-Expression
When i run this line it just accepts it and returns nothing. Then when i try to call fnm its no longer in path. I ran "fnm env --use-on-cd" to try and look at its result and it doesnt look like it gets the ü wrong here. 😕
interesting. would be great to understand what is special about your setup. i have some tests and i need to know how to repro 🙏
There is nothing special about customizing it. The issue is the username, which has characters other than English. 90% of tools designed for programmers (especially on windows) suffer from this problem. It's just not so obvious. Either it works, but incorrectly (as in this case), or it simply refuses to work
you can check this by using the same command fnm env ...
removing the last | ...
and see what non-existent paths fnm
writes.
First of all: it's just inconvenient to write such a thing in each console configuration, because you can open any console in the terminal and the tool won't work (for example in vs code).
Second: unusual behavior when there is no content in .node-version
file. At first I didn't understand why in windows terminal node
version is displayed, but here it just resets, but it can be fixed I think, but maybe so in nvm
(never checked for an empty file nvm
itself). Just pointing that out
with the absence of the .node-version
file or writing a version to it, everything works well
I'm sure the env var is corrent
I suggest you just reinstall windows if you can and change your username to English letters. I guarantee you will breathe a lot easier. I reinstalled and everything worked right away and not only that
I encountered an issue when I attempted to use the link provided. Windows requires a terminal reload to resolve the problem.
Hi, I think I found a good fix for this: You need to change the output encoding of Powershell to utf8 in order for Out-String to not garble special characters, i.e. in your profile write
[Console]::OutputEncoding = [System.Text.Encoding]::utf8
fnm env --use-on-cd --shell power-shell | Out-String | Invoke-Expression
Maybe the instructions in the README should be updated to this. I don't know if changing the output encoding in your profile breaks any other programs, so maybe the general recommendation should be to save the current value of OutputEncoding to a variable, execute the above and then change back to the stored encoding.
Good day ALL, please can someone help with the step-by-step guide on how to go from f# installs fnm (Fast Node Manager) winget install Schniz.fnm
fnm env --use-on-cd | Out-String | Invoke-Expression
fnm use --install-if-missing 20
node -v # should print v20.18.0
npm -v # should print 10.8.2
I keep getting error when I run this fnm env --use-on-cd --shell power-shell | Out-String | Invoke-Expression
this is the error: C:\Windows\system32>fnm env --use-on-cd --shell power-shell | Out-String | Invoke-Expression 'Out-String' is not recognized as an internal or external command, operable program or batch file.
Any advise on how to go about this
this is the error: C:\Windows\system32>fnm env --use-on-cd --shell power-shell | Out-String | Invoke-Expression 'Out-String' is not recognized as an internal or external command, operable program or batch file.
Any advise on how to go about this
You appear to be in CMD rather than PowerShell.
I installed fnm with cargo, used powershell.
But after I add the following to the end of my profile file:
fnm env --use-on-cd | Out-String | Invoke-Expression
the mistake would come out:
I'm sure the env var is corrent