NPM Command line doesn't work in Visual Studio Code From Visual Studio 2022 node.js workload install

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys Logan Dunning from Logan dunning.com have you ever been in a situation where you've installed Visual Studio the latest non-visual Studio code and you have installed node um node.js and for some reason when you go over to visual studio code you know you type in npm help and it doesn't know about that but you know if you went over to you know Visual Studio you know and opened either a developer command prompt or developer Powershell that seemed to work and can I press up and that seemed to work as well so why is that so for some reason if we look over on like an installer of visual studio and you go to modify and you look at maybe individual components and you just search for like node so it's it's installed right like so the thing is um in the past I fixed this by going to um you know download the latest version of node and then you got two in there two different potentially two different versions one set one that ships with visual studio uh you know 2022 or and then you also have your local installed one which can in my experience have these weird hiccups so I'll show you what I did to resolve this and it's pretty simple um so let's say that you wanted to use the node.js that Visual Studio full-blown IDE comes with over on Visual Studio code or anywhere really um so like I said it works here what you want to do is you want to hit the start a start menu and then type in the word environment variables and this guy will come up here and you're going to go to environment variables and this whole idea about the path right so when you put things in the path um it's like the way um it will like from any command prompt kind of anywhere like if there's some kind of a command uh it has access to it it's like kind of like a global using like a cross OS using statement now I didn't even test to put it in this one the specific path for the current logged in user in Windows you know eight nine ten well not nine they didn't do nine ten and eleven I'm on 11. but I put it in the you know OS wide so the machine wide so if you go to edit here on the path um and it really is really weird if you think about it like if Visual Studio 2022 is installing um node.js why wouldn't they put it in the path like automatically or at least give you an option when you download an install node from the website they they give you an option and they'll put it in the path for you but it does you know it's very helpful to have that so um I have found where so how I did this was and this will probably have to change per you know as they increment the version numbers of visual studio and put this thing in different spots um you're gonna have to find the location of where Visual Studio 2022 uses the npn command so I was able to determine that by essentially just looking if you scroll up here it'll show you kind of the basic uh path it's something similar to this I think but not exactly that um so I'll put the sorry I'll uh copy and paste this and put it in the description in the video down below if you're interested in just seeing if it blindly works but you probably have to um maybe update it over time as Visual Studio changes so I'm going to say new um and I'm gonna say paste and if we look at this URL not sure if I can expand this yes I can nice so we got um program files Visual Studio 2022 Community Ms build Microsoft Visual Studio node.js and if I just paste that in if I hit start and press enter on that I'll just bring it around so you'll see that in there it has um the application but this is I believe the command that it's running so when you type in npm because look nothing else in this folder is npm and this is just a Windows command script and then you can say uh show more options and edit and it says created by npm don't edit manually okay so that I assumed that that was the command right so I just paste this thing in here and um just make sure it's saved yeah it's there we'll go okay now I figured it would work right away um it didn't and I was like okay maybe I have to reboot and then I was like well before you do that let's kind of jumping the gun just close it and reopen it foreign there we go there's the previous messages let's just clear on that and then we'll go npm help and there you have it so once it's in the path it will actually use the npm from Visual Studio 2022 in Visual Studio code or the new jetbrains minimal IDE or any kind of text editor that you want once it's in the path then you have the power so I hope you guys like that quick demonstration on how you can put npm in the path from the default install of Visual Studio 2022 and then you can consume it somewhere else like Visual Studio code and whatnot hope you guys appreciated the video in any way if you did please hit the like And subscribe and I'll see you next time thanks
Info
Channel: Logan Dunning
Views: 43,805
Rating: undefined out of 5
Keywords: Node.js, Node, Npm, Visual studio, Vs code
Id: qx76EITFxDY
Channel Id: undefined
Length: 6min 30sec (390 seconds)
Published: Thu Oct 27 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.