Configuration of the node.js environment

Because I want to start researching the use of react native in the project, I need to install node.js first

Node.js environment installation configuration

1. Download node.js and select the required installation version on the official website. URL: https://nodejs.org/en/

  After downloading, just click install. It's very simple, just click next

2. The conventional node construction has been completed, and the node test is performed below. Run the command line as administrator.

After cmd enters the command line, generally after node.exe is installed, it will automatically configure your directory for system variables. After running the command line, test node -v to check the version of node.js

Then enter again, npm -v test, check the npm version

If there is no problem, the preliminary installation is complete.

3. The node configuration is performed below, and then the node_cache and node_global folders are created under the installation directory (my directory: D:\Program Files\nodejs). Enter the command in cmd: (note to change to your own installation directory~)

npm config set prefix “D:Program Files\nodejs\node_global”
npm config set cache “D:Program Files\nodejs\node_cache”

4. The module can now be installed: enter npm install express -g on the command line (Note: -g means that the global installation is installed in the node_global directory)

5. Environment variable configuration: My Computer (right-click) → Properties → Advanced System Settings → Environment Variables to configure the corresponding environment variables. (Note: Remember to change to your own installation directory~)

Create a new NODE_PATH under system variables and enter "D:\Program Files\nodejs\node_global\node_modules"

Create a new node_path under User Variables and enter "D:\Program Files\nodejs\node_global\node_modules"

6. Verify that the express installation was successful. Re-open a command window, enter node, and then enter require('express'), the installation is successful and you will see the following display.

7. To install supervisor, first enter npm---"npm install -g -supervisor on the command line

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326135258&siteId=291194637