Installing node. js and NPM

Source: Internet
Author: User
Tags install node

Because the node. JS platform is running JavaScript code on the backend, you must first install the node environment in the native computer.

Install node. js

Currently, the latest version of node. JS is 7.6.x. First of all, download the corresponding platform from the node. JS website installation program, the slow speed of children's shoes please step into the domestic mirror.

Be sure to select all components when installing on Windows, including tick Add to Path .

After the installation is complete, in the Windows environment, open a command prompt, and then enter node -v , if the installation is OK, you should see v7.6.0 such output:

C:\Users\IEUser>node -vv7.6.0

Continue at the command prompt node and you will enter node. JS's interactive environment at the moment. In an interactive environment, you can enter any JavaScript statement, for example 100+200 , a carriage return will result in the output.

To exit the node. JS environment, double-click CTRL + C two times.

Video address:

Http://github.liaoxuefeng.com/sinaweibopy/video/node/install-node.mp4

In a Mac or Linux environment, open the terminal and enter node -v it, and you should see the following output:

$ node -vv7.6.0

If the version number is less than the v7.6.0 node. JS version is incorrect, the code in the later sections is not guaranteed to work correctly, please reinstall the latest version.

Npm

Before we formally start the node. JS study, let's meet NPM first.

What is NPM? NPM is actually a package manager for node. js.

Why do we need a package management tool? Because we developed it on node. js, we used a lot of JavaScript code written by someone else. If we want to use someone else to write a package, each time according to the name of the official website search, download code, decompression, re-use, very cumbersome. So a centralized management of the tool came into being: we all put their own modules into the development of the NPM online, if you want to use, directly through the NPM installation can be directly used, no tube code exists where, should be downloaded from.

More importantly, if we want to use module A, and module A is dependent on module B, module B also relies on module X and module y,npm to download and manage all dependent packages based on dependencies. Otherwise, by our own manual management, must be both troublesome and error prone.

With so much to say, where is NPM?

In fact, NPM has been installed in the node. js in passing. We should see similar output at the command prompt or terminal input npm -v :

C:\>npm -v4.1.2

If you enter directly npm , you will see output similar to the following:

<command>where <command> is one of:    ...

A bunch of words above tell you that you npm need to keep the order. Now we don't have to worry about these orders, we'll talk about them later. For now, all you need to do is make sure that NPM is properly installed and can run.

Summary

Install the node. JS environment on your computer and ensure that it is functioning node npm properly.

Above, turn from the Xuefeng Liao

Http://www.liaoxuefeng.com/wiki/001434446689867b27157e896e74d51a89c25cc8b43bdb3000/ 00143450141843488beddae2a1044cab5acb5125baf0882000

Http://www.runoob.com/nodejs/nodejs-npm.html

Introduction to NPM usage, rookie

If you're installing an older version of NPM, you can easily upgrade with the NPM command,

If the Window system uses the following command:

-G

Installing node. js and NPM

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.