当前位置:网站首页>Nodejs installation and global configuration (super detailed)
Nodejs installation and global configuration (super detailed)
2022-08-02 06:56:00 【m0_67392811】
安装node.js
Download the appropriate one for your computer systemNode.js版本:下载 | Node.js 中文网
我这里下载的是node-v16.13.0-x64.msi,如下图

下载完成后,双击”node-v16.13.0-x64.msi“,会看到如下界面,然后开始安装



nodejs在D盘根目录下,该文件是空的





到这里node.js已经安装完成, 可以先进行下简单的测试安装是否成功了,后面还要进行环境配置 在键盘按下【win+R】键,输入cmd,然后回车,打开cmd窗口


安装完后的目录如下图所示:

全局配置node.js
说明: 这里的环境配置主要配置的是npm安装的全局模块所在的路径,以及缓存cache的路径,之所以要配置,是因为以后在执行类似:npm install express [-g] (后面的可选参数-g,g代表global全局安装的意思)的安装语句时,会将安装的模块安装到【C:Users用户名AppDataRoaming pm】路径中,占C盘空间.
I want to put the path where the global module is located and the cache path in menode.js安装的文件夹中,则在我安装的文件夹nodejsCreate two folders manually【node_global】和【node_cache】

然后打开cmd命令窗口,输入(Note the difference in the words of the two lines of commands)
npm config set prefix "D:
odejs
ode_global(Write the path where your file is located here)"
npm config set cache "D:
odejs
ode_cache(Write the path where your file is located here)

接下来设置环境变量,关闭cmd窗口,“我的电脑”-右键-“属性”-“高级系统设置”-“高级”-“环境变量”

进入环境变量对话框,将【用户变量】下的【Path】修改为【D: odejs ode_global】


修改完成后,点击确定按钮.然后在【系统变量】下新建【NODE_PATH】,输入【D: odejs ode_global ode_modules】

配置完后,安装个module测试下,我们就安装最常用的express模块,【win+r】打开cmd窗口, 输入如下命令进行模块的全局安装:
npm install express -g #-g是全局安装的意思

You will find an installation error,The error message is that the operation is not allowed.这是因为nodojsThe module operation permission in the file is insufficient(There is a workaround onlineAppDataThe suffix under the same level is .npmrc的文件删除,但是删除后node.jsThe global configuration is automatically restored toC盘,Therefore, this operation requires caution).So I don't do this kind of operation on the Internet here,We can modify the permissions ourselves.
Modifying permissions is divided into two steps,The first step is to modify your installationnode.jsfolder permissions
关闭cmd窗口,找到你安装node.js的文件夹(我的文件夹是nodejs) -右键-属性-安全


之后会出现如下提示,Keep clicking continue

You can see that the first character already exists"完全控制"的权限了,Repeat the steps to modify the permissions of the first role for the other three roles,Until these four characters have it"完全控制"until the authority

The second step is to modify your installationnode.jsPermissions for subfiles of the folder,如下图

Repeat the first step to modify permissions,The three files framed above must be modified,Every character is also modified.
After all permissions are modified,【win+r】输入cmd,打开cmd窗口,输入
npm install express -g


when you install itexpressIf the module appears in the custom global path, the installation is successful(如上图所示).
到这里,node.jsThe global configuration is also completed??.
今天的分享就到这里啦~~
如有错误,Welcome to Yazheng anytime.
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在.深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小.自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前.因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担.添加下方名片,即可获取全套学习资料哦
边栏推荐
- VMTK环境配置记录
- The advantages of making web3d dynamic product display
- 目标检测重要概念——IOU、感受野、空洞卷积、mAP
- pytorch基本操作:使用神经网络进行分类任务
- Integrate ssm (1)
- 引领需求 为HR价值正名——“人力资源领先模型HRLM”成功首发
- A list of 300+ learning resources compiled by senior engineers of the Tao Department (the latest version in 2021)
- Features and installation of non-relational database MongoDB
- npm ---- install yarn
- 双重for循环案例(用js打印九九乘法表)
猜你喜欢

MySQL高级-MVCC(超详细整理)

触发器简单解释

MarkDown Formula Instruction Manual

MySQL索引常见面试题(2022版)

npm does not recognize the "npm" item as the name of a cmdlet, function, script file, or runnable program.Please check the spelling of the name, and if the path is included, make sure the path is corr

node安装及环境变量配置

Node installation and configuration of environment variables

金蝶国际:半年亏掉去年一年,疯狂烧钱的商业模式如何持续

MySQL 23道经典面试吊打面试官

Important concepts of target detection - IOU, receptive field, hole convolution, mAP
随机推荐
Shell 脚本不同玩法
Analysis of the source code of the JS UI framework of Hongmeng system
What is the most important ability of a programmer?
关于 VS Code 优化启动性能的实践
Nacos数据库配置
制作web3d动态产品展示的优点
c语言指针运算
MySQL Index Common Interview Questions (2022 Edition)
程序员写PPT的小技巧
【OpenCV从入门到实践】图像处理技术[像素](全网最详细)
股价屡创新低 地产SaaS巨头陷入困境 明源云该如何转型自救?
Deep learning - CNN realizes the recognition of MNIST handwritten digits
MySQL 5.7 安装教程(全步骤、保姆级教程)
蚂蚁三面:MQ 消息丢失、重复、积压问题,有哪些解决方案?
Machine learning -- - theory of support vector machine (SVM)
BGP实验(路由反射器,联邦,路由优化)
node安装及环境变量配置
BGP+MPLS综合实验
flex layout (flexible layout)
MySql COUNT statistics function explanation