nodejs安装时遇到的问题及解决方案

一、引言

很高兴我的文章 nodejs安装和环境配置-Windows 受到了大家的喜爱。很多人根据这个文章去安装配置nodejs。

由于很多朋友在安装过程中或者安装完成后出现了各种各样的问题。
并且这些问题大多都是重复的。
这篇文章则是对安装过程中朋友们出现的问题进行一个汇总和解决。
持续更新。。。

下面进入正题

二、问题汇总及解决

2.1 npm -v 命令出现npm WARN logfile could not be created: Error: EPERM: operation not permitted, open xxx

具体警告内容如下:

npm WARN logfile could not be created: Error: EPERM: operation not permitted, open ‘E:\Install nodejs\nodejs_cache\node_cache_logs\2022-07-11T03_06_41_846Z-debug-0.log’
npm WARN logfile could not be created: Error: EPERM: operation not permitted, open ‘E:\Install nodejs\nodejs_cache\node_cache_logs\2022-07-11T03_06_42_656Z-debug-0.log’

在这里插入图片描述
解决方法:以管理员身份运行CMD

2.2 运行命令出现 npm WARN config global --global, --local are deprecated. Use --location=global instead.

出现这种情况应该是和nodejs版本有问题。
解决方法:
找到nodejs目录,找到npm.cmd文件,右键npm.cmd文件,选择编辑
在这里插入图片描述
红圈处,更改为prefix --location=global即可
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_52799373/article/details/125718587