Home>Article>Web Front-end> Introduction to nodejs installation and configuration environment methods
Using vue, installingnodejsis the basis. I will teach you my own installation steps here. [Video tutorial recommendation:nodejs tutorial]
Download address: https://nodejs.org/en/download/
1. After downloading, double-click to open:
2. Click next to start installation
3 .Select the "Accept button" and proceed to the next step
4.Select the installation path
5.Install the mode you need
6 .Start the installation install
7.Complete finish
NodeJS and NPM cannot be used directly after they are installed. By default, the modules installed by NPM will not be installed in the NodeJS program directory, such as the ones we installed. When we set the D drive, "D:\Program Files\nodejs", and we use npm to install a cluster module, it will appear under the default path of the C drive. Therefore, if we do not modify the module installation directory of npm, then it will default to It will be installed here in every situation. As you test and develop various projects and install more and more modules, the size of this folder will become larger and larger until it fills up your C drive. So we need to modify the npm configuration.
This is used to store the cache files of the installation process and the final module configuration location
npm config set prefix "The path to the node_global file "
npm config set cache "node_cache file path"
For example: npm config set prefix "D:\Program Files\nodejs\node_global"
Add new system variables:
Fill in the variable name: NODE_PATH
Fill in the variable value: (file path)
You also need to add Modify the default path of the nodejs file in the Path variable name
Test after the modification is completed:
Enter the command: node and press Enter - then enter require('cluster')
The above content indicates that the configuration is complete
For more programming-related knowledge, please visit:Introduction to Programming! !
The above is the detailed content of Introduction to nodejs installation and configuration environment methods. For more information, please follow other related articles on the PHP Chinese website!