Joe has been a web developer for the last 13 of his 16+ years as a professional developer. He has specialized in front end and middle tier development . Although his greatest love is writing code, he also enjoys teaching and speaking about code.
Advanced NPM When you find a module on GitHub that you want to use, almost all modules are going to tell you how to install them with npm. For example, here's the page for Express, and you can see right here that it gives us the command, npm install express. But you may find a repo online that you don't know what the name is for it in npm, or it might be a fork of an existing project that's been modified for some reason, maybe custom to you, and therefore you have a GitHub URL that you know that you want to install from, but you don't necessarily know what the npm install name is. In this case, you can install directly from GitHub, using just the URL. So if I wanted to install Express from a URL, I can just give it the full URL, and that's going to install Express for me. This is exactly the same as if I were to type npm install express. And one thing to note about this, is it's not limited to just GitHub, if for some strange reason you have a package that's available on some other URL, you can just type in that URL as well, and npm will install it from that location.
Publishing Your Own Package In order to get ready to publish with npm, you've got to prepare your user for publishing. For most people that means they'll actually have to create a user account with npm first. In order to do that you go to nmpjs. com and click sign up. From here, simply follow the prompts in order to create your user account and be sure to remember your user name and password. At that point, you can go out to your command line, you'll need to add the user using the npm adduser command. Executing this will prompt you to type in your username, your password and enter your email address. Once you've done all that it will add an npm authentication token to your npm RC file. Your user is now setup and you can begin publishing packages.