Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

308
Visualizações
How do I force my Linux distro in WSL2 on Windows to use the Linux version of nvm and not the Windows version?

I have nvm for Windows installed and when I do a whereis nvm when logged into my Pengwin Linux distro via WSL2 it shows it's using the binary on the Windows filesystem mount at /mnt/c/Users/seefe/AppData/Roaming/nvm/nvm.exe. This is despite also going through the Linux installation procedure for nvm, which I assumed would hide the Windows version.

It's the same with gatsby-cli. The problem is when in Linux Land, running nvm and gatsby is a chore because the response time for commands across file systems is too slow. What's the WSL environment strategy for ensuring any packages I install via npm when in Linux are installing and using the packages specifically on the Linux filesystem?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Apologies for leading you in the wrong direction with this answer originally.

After installing nvm again in a test WSL session (I usually use n myself) I see that Linux nvm is installed as a bash function, not as a binary. This means that whereis nvm doesn't actually see it, since whereis only looks for files.

> type nvm | head -1
nvm is a function

Two things to note:

  • When entered without a fully-qualified path (absolute or relative), the function will take precedence over a binary. So as long as type nvm returns the function, you should be fine.

    And the fact that you mention (in the comments) that your path starts with /home/seefer/.nvm/versions/node/v14.18.0/bin means that the Linux nvm is working correctly and prepending the correctly activate directory to your path.

    If you are experiencing issues with node or npm after using the nvm use or nvm install commands, let us know.

  • While whereis nvm finds /mnt/c/Users/seefe/AppData/Roaming/nvm/nvm.exe, you would have to actually run nvm.exe for it to run the Windows version.

There is one more thing to watch out for here, though, that is related to that other answer.

npm on Windows is a strange one, since it actually does ship with a shell script (even though it is for Windows) named npm that in turn calls the Windows npm.exe. If you have Windows Node/NPM installed (and it sounds like you do), be careful that you always active the Linux version (so that it is prepended to the path) with the Linux nvm.

Otherwise you can get into issues with Windows npm trying to run under WSL/Linux.

Be careful with this. As long as you have activated a node/npm installation with the Linux

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda