Running NPM in VSC

Hello,

In Windows, I used to run npm in Visual Studio Code. But now I'm unsure why the command is not detected in VSC. I confirm that I have installed both npm and node.
image

But in VSC, my npm command is not recognized.

I googled around, and it seems to be something to do with my VSC terminal no longer has the Powershell option, it is now Bash. Anyone has any experience with this?

Sorry, I'm new to Linux but I'm in love with Zorin and won't mind learning what's needed to make it work.

Thanks in advance.

It is installed - we can see your evidence of that. I would suggest checking your path set for nodejs and npm in vscode. It is the only thing I can think of off the top of my head that could cause npm command to not be recorgnized.

thanks a lot for the direction. I found the problem. I removed the installation (which I installed from Software in Zorin — I think it is flatpak), and downloaded the deb version from Visual Studio website. Hmm.. it looks like some software may not work properly If downloaded from sources other than its original one.

Thanks for your pointer. Without which, I am still trying to investigate the NPM portion :slight_smile:

The --version option should only work on software installed through APT, not Flatpak or Snaps.

oh, I meant I removed the VSC installation which I downloaded from Flatpak. I never tried to --version the VSC though.

I installed npm and nodejs using APT.

1 Like

Any IDE, Code, Android Studio, IDEA, should be installed by deb or an apt repository. Flatpak and snap don't have the permissions to add to PATH.

I use all three that I mentioned, as well as RStudio and have not had issues.

In VSCode, or any IDE for that matter, use virtual environments so as not to add packages to the OS dependencies (mainly for python, but any language that includes or offers virtual environments, they should be utilized). This will also keep your requirement.txt files clean (they will include Zorin python packages otherwise).

You may want to explore Codium of you want to get away from embedded M$ services.

Happy coding!

2 Likes

@337harvey Is correct, this issue is is well known when installing VSCode as a flatpak as the integrated terminal does not have full access to the system. Installing through apt should do the trick. I would also suggest using VSCodium instead, which is VSCode sans the telemetry.

Make sure to follow the instructions from the Node.js website for Ubuntu and Ubuntu-based distributions, as otherwise the version of Node.js will likely be severely out of date.

1 Like

Thanks @zenzen, my version is indeed severely outdated when I first did an apt install. It is at the latest version now after I followed the instruction.

Also, thanks to @337harvey , for the information. I will also check out VSCodium.

I've installed VSCodium, and it runs perfectly fine. Thanks so much for the suggestion. It's my first time learning about VSCodium

1 Like

Moved solution to post #6.

Done. Thanks a lot @Aravisian and all.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.