Score:0

npm command not found in wsl

gb flag

I had installed nodejs on windows10 & its path is also set to environment variable. It is working perfectly. As I switched to WSL I found npm commands were not working however I could run node.exe from within WSL. Do I need to install node for wsl separately? please help me I am really a newbie. I might be asking a silly question though. screenshot attached here

Score:1
ru flag

node.exe is NodeJS from your Windows environment - that's for Windows, not WSL.

You need to install NodeJS from the NodeJS repositories inside of WSL in order to use npm and Node within WSL. DO NOT rely on the Windows solutions for installing WSL.

Microsoft has specific documentation on how to do this, provided you're using WSL2. I would suggest following the Microsoft documentation. (Not copied here because it's a fairly involved process 'cause of making sure you've got WSL2 and such)

sourav roy avatar
gb flag
thanks for your response @thomas sir. It clarifies my doubt. The same happened to some other programs also. I need to fix it.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.