Choosing a Node.js installation process
Video: Choosing a Node.js installation processInstalling Node can be simple and predetermined or it could be customized to suit your needs. Let's take a look at the available options. So, first I'm at nodejs.org. And this is where you can install Node via a precompiled binary. All you have to do is click this install button and it will automatically download the precompiled binary for your computer. There are a couple of advantages with using a precompiled binary. The first advantage is that it's easy. It's a wizard based installation. If you've installed any other software on your computer before, it's likely to be a very familiar process for you.
Viewers: in countries Watching now:
- Why use Node.js?
- Installing Node.js
- Understanding the event loop
- Initializing Node.js projects
- Creating modules with getters and setters
- Starting Express applications
- Testing your code
- Working with sessions and databases
- Building command-line tools
- Emitting events and attaching listeners
- Controlling readable streams
Choosing a Node.js installation process
Installing Node can be simple and predetermined or it could be customized to suit your needs. Let's take a look at the available options. So, first I'm at nodejs.org. And this is where you can install Node via a precompiled binary. All you have to do is click this install button and it will automatically download the precompiled binary for your computer. There are a couple of advantages with using a precompiled binary. The first advantage is that it's easy. It's a wizard based installation. If you've installed any other software on your computer before, it's likely to be a very familiar process for you.
The other advantage is that it's automatic. It's going to configure the environment for you. You don't have to look for hidden files and type in a bunch of commands that you're not going to be familiar with. The installer is going to automatically configure everything for you. There are also a few disadvantages of using precompiled binaries. The first is that whenever there is an update to Node, you have to download the package and go through the wizard again. And another related disadvantage is that switching between different versions of Node involves going through the entire installation process.
So, if you want to test something on different versions of Node. You have to go through the entire wizard all over again just to make that test. So let's take a look at another installation process. Another way of installing Node on your computer is to use a version manager. This is the github page for Node version manager, NVM. It's the version manager that I personally prefer to use. There are several advantages of using a version manager. The first advantage is it allows you to install any version of Node with a a short command.
All you have to do is type in that command. And the version you want, and it will automatically download and install that version of node on your computer. Another advantage is that switching between versions is as simple as issuing another short command. So again, you just type in that command, specify the version that you want, and it will do all the rest for you And the final advantage of using a version manager is that it provides an easy, consistent way of installing Node on Linux. There are however, some disadvantages with using a version manager.
One disadvantage is that there's no wizard-based installation. You have to be reasonably comfortable with command line interfacees for this to work. Now, node uses the command line for a few other things as well. So familiarity with a command line interface is also going to be helpful as you use Node. Another disadvantage is that you may have to reinstall your global modules whenever you switch between different versions of Node. We'll be talking about global modules later in the course. But they're generally commands that you will install on top of Node.
Another disadvantage is that you have to install the version manager before you use it to then go and install Node, so in this case you are installing two things rather than just installing Node itself. Finally, there is one more way to install Node on your computer and that's to actually compile it from source. This git-hub page is where all of the code for Node is hosted. There are some advantages to compling from source. The first advantage is that you can test the very latest code from the Node development team. So if you want to be on the cutting, bleeding edge of what Node is doing you can get it and compile it.
The other advantage is that you can customize the installation. So if you have specific needs for your computer, for instance if you are using a very obscure operating system, or you have very specific ways that you want to have Node configured, this might be the best way to get it on your computer. There are also some disadvantages of compiling from source. First of all, you have to be familiar with the compilation process. Now if you've compiled other things on your computer before, compiling Node is going to be very similar. But if you're not familiar with the process, it can be a little bit daunting at first.
Another disadvantage is that it's going to take longer to install. Whenever you compile code, you have to read it, and parse it, and build it and make it. And then get it installed on the computer. And this process is going to take a while. And the final disadvantage is that, it's not as easy to switch between different versions as it is when you use a version manager. Whenever you want to switch to a different version, and you've compiled node, you're going to have to go through that compilation process all over again. So, which of these three processes do I use? I personally use a version manager.
It gives me the flexibility of switching Node versions whenever I need to. There are sometimes when I'm debugging code and I want to see if it behaves differently under a different version. I find the command line to be convenient and that allows me to update Node with just one command. Now there's nothing wrong with using a precompiled binary or compiling your own copy from source. But I find that a version manager works best for my needs. So in the next few videos we'll take a look at installing Node using precompiled binaries as well as using a version manager.
You can watch the one you prefer to use or you can watch both methods and see which one suits you best.
Find answers to the most frequently asked questions about Node.js Essential Training .
Here are the FAQs that matched your search "" :
- Q: How can I install the new version of the Express command-line tool?
- A: Newer versions of the Express command-line tool can be installed using the command "npm install -g express-generator." But before doing this, you should first remove any older version of the module, using the command "npm uninstall -g express."
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.