node installation and configuration environment

Installation Node.js Step
1, corresponding to its own system corresponding to the download version Node.js, Address: https://nodejs.org/zh-cn/
2, selected from the installation in the installation directory D: \ nodejs 3, environment configuration

1, omitting Step 2

Installation View
  1 to see if the installation was successful

  A, node -v view node version

  B, npm -v view npm version

  2, after installation, the file below the directory

3 environment configuration

Environment configuration npm main configuration of the path of the global module mounting location, and the path of the cache buffer, the reason for the configuration, because after performing similar: npm install express [-g] (back of the optional parameters -g, g the representative of the overall global mean installed) the installation of the statement, will install the module to [C: \ users \ username \ AppData \ Roaming \ npm] path, accounting for C disk space.
  For example: I want to block the path and the full path to the cache files on my node.js installation folder, create two folders in my installation directory node_global [] and [] node_cache below:

  1, set the global directory and cache directory, create an empty folder after two complete, open cmd command window, type

npm config set prefix "D:\nodejs\node_global"

npm config set cache "D:\nodejs\node_cache"

  2, set the environment variable, "My Computer" - Right - "Properties" - "Advanced System Settings" - "Advanced" - "Environment Variables"

  A, into the Environment Variables dialog box, the new [NODE_PATH] in [System variables], enter [D: \ nodejs \ node_modules] this can not configure

  B, will modify the variables [user] under [Path] is [D: \ nodejs \ node_global]
If not msi version, you also need to modify the configuration [Path] [D: \ nodejs; D: \ nodejs \ node_global ]

Guess you like

Origin www.cnblogs.com/onefish/p/11404668.html