当前位置:网站首页>Very simple installation and configuration of nodejs

Very simple installation and configuration of nodejs

2022-06-13 03:42:00 Hacah

install NodeJS And configuration

One 、 summary

NodeJs It's a JavaScript Operating environment , be based on V8 engine . send JavaScript It is possible to implement back-end programs .Node.js Use an event driven 、 Non-blocking type I/O Model of , Make it lightweight and efficient .Node.js The software package ecosystem of npm Is the world's largest open source repository ecosystem

Two 、windows install

Node.js Official website download :https://nodejs.org/en/download/

image-20220226095551653

Click the corresponding version to download , After installation , View the version on the console , Confirm that the installation is effective .

image-20220226095706722

Open the installation directory to view ,npm Also installed here .

image-20220226095825787

3、 ... and 、 To configure

Due to the global installation , Will be installed to C Discoid C:\Users\ user name \AppData\Roaming The next path npm and npm_cache Next , To customize the installation path , stay node.js Create two new folders under the installation directory node_global and node_cache.

image-20220226100752811

open cmd, Enter the configuration command

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

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

image-20220226100058838

You also need to configure environment variables

“ environment variable ” -> “ System variables ”: Create a new variable named “NODE_PATH”, The value is “D:\Environment\nodejs\node_global\node_modules”, Here's the picture :

image-20220226101002028

“ environment variable ” -> “ User variables ”: Edit... In the user variable Path, modify npm The path of (“C:\Users\ user name \AppData\Roaming\npm”) Change it to :“D:\Environment\nodejs\node_global”, as follows :

image-20220226101143767

Four 、 test

perform npm install http-server -g To install a http The server

image-20220226102309483

原网站

版权声明
本文为[Hacah]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202280527301882.html