Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to install and use NodeJS using FNM

I installed FMM on my windows 10 laptop using below command winget install Schniz.fnm

After installation, I downloaded NodeJS using fnm install 16.2.0

After this step when I type fnm use 16.2.0 I get below error

error: We can't find the necessary environment variables to replace the Node version. You should setup your shell profile to evaluate fnm env, see https://github.com/Schniz/fnm#shell-setup on how to do this Check out our documentation for more information: https://fnm.vercel.app

I tried below commands in power-shell. But this does not help me :(

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

notepad $profile

@echo off
:: for /F will launch a new instance of cmd so we create a guard to prevent an infnite loop
if not defined FNM_AUTORUN_GUARD (
    set "FNM_AUTORUN_GUARD=AutorunGuard"
    FOR /f "tokens=*" %%z IN ('fnm env --use-on-cd') DO CALL %%z
)
like image 787
sairaj Avatar asked Nov 19 '25 16:11

sairaj


1 Answers

Run below command in PowerShell before installing NodeJs -

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

I was getting the same error, was able to install node after I ran it.

Image

enter image description here

like image 60
developerick Avatar answered Nov 24 '25 13:11

developerick



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!