1. Download the installation package
/zh-cn/download/
According to their own computer system and the number of bits to choose, my computer is a Windows system, 64-bit, want to download the stable version of the .msi (LTS for the long-term stable version) here to choose windows 64-bit .msi format installation package.
-
.msi is a program installation file developed by Windows installer that allows you to install, modify, and uninstall the program you have installed. To put it bluntly .msi is the Windows installer's data package, which encapsulates everything related to the installation file in one package. In addition: it contains information about the installation process itself. For example: installation sequence, destination folder path, installation options and properties that control the installation process.
-
The .zip is a compressed package that is unzipped and ready to go, no installation required!
2. Installation procedures
① After the download is complete, double-click the installation package, start the installation, the use of the default configuration of the installation has been point next can be installed, the default installation path in C: Program Files, you can also customize the changes!
② The default installation path is under C:Program Files, you can also customize the changes, and then click next (I set my installation directory as E:KF according to their own needs to change).
③ the following chart according to their own needs, I chose the default runtime, and then Next
runtime : indicates the runtime environment npm package manager: denotes the npm package manager online documentation shortcuts : online documentation shortcuts Add to PATH: add to environment variable
④ As shown in the box below, I didn't check it, but just NEXT
⑤Click Install to install
⑥ Click finish to complete the installation
⑦ After the installation is complete, the .msi format of the installation package has been added to the node startup program to the system environment variable path, we can view the system variables to verify: in the [personal computer] right-click ¡ú [Properties] ¡ú [Advanced System Settings].
⑧ Click [Advanced] → [Environment Variables].
⑨ Check [path] in System Variables and click [Edit].
⑩ will find that the .msi format installation package has added the node launcher to the system environment variable path
3. View
① Since the node program has been added to the global system variables, we can directly execute node anywhere in the CMD window, open the CMD window, execute the command node -v to view the node version!
[Note: This opens a CMD window and is not executed in the C:Program Files odejs directory].
② the latest version of node in the installation at the same time also installed npm, run npm -v check npm version
③ By default, when we execute npm install -g XXXX, we download a global package, the default storage path of this package C:UsersAdministratorAppDataRoaming pm ode_modules under the CMD command npm root -g to see the package.
⑤ A selection of frequently used commands, below:
npm -v: View the version of npm installed.
npm init: will walk you through creating a file, including information such as name, version, and author.
npm list: View installed node packages in the current directory.
npm ls: View installed node packages in the current directory.
npm install moduleNames: installs Node modules into the local directory node_modules.
npm install < name > -g: Install the package into the global environment.
npm install < name > --save: install at the same time, the information will be written in the project path if there is a file, directly using the npm install method will be able to install all the dependencies according to the configuration of the dependencies, so that the code is submitted to the git, you do not have to submit node_modules this folder.
npm install < name> --save-dev: installation at the same time, the information will be written in the project path if there is a file, directly using npm install method will be able to install all the dependencies according to the configuration of devDependencies, so that the code is submitted to the git, you do not have to submit node_modules folder. modules folder.
npm uninstall moudleName: Uninstall the node module.
4. Environment Configuration
① Open the installation directory (C:Program Files odejs in the default installation).
② Create two new folders [node_global] and [node_cache] in the installation directory.
③ Open the cmd command window again, and type npm config set prefix "your path ode_global" ("your path" is C:Program Files in the default installation). odejs)
npm config set prefix "E:KF
odejs
ode_global"
④ npm config set cache "your path ode_cache" can be copied directly to the empty folder directory you just created.
npm config set cache "E:KF odejs ode_cache" 1 2 3 It is recommended to use administrator privileges to open the CMD, otherwise there may be prompted by insufficient privileges to report errors
⑤ Set environment variables, open [System Properties] - [Advanced] - [Environment Variables], and create a new
Variable name: NODE_PATH
Variable value: C:Program Files odejs ode_global ode_modules
(to tell the system that the downloaded modules or packages are here)
Edit the path of the user variable (environment variable), change the default APPDataRoaming pm under the C drive to C:Program Files odejs ode_global, and click OK.
Finally, don't forget to add NODE_PATH to the Path.
⑦ test, configure the completion of the installation of a module test, we install the most frequently used express module, open the cmd window, enter the following command for the global installation of the module:
npm install express -g // -g is for global installation 1
5. Highlights
For more great content and source code access, stay tuned!Public:Every bit as happy as you can be.
May you be happy every point of every day~(●'◡'●)~