npm install报--4048错误和ERR_SOCKET_TIMEOUT问题解决方法之一

一、问题描述

学习vue数字大屏加载动漫效果时,在项目终端页面输入全局下载指令

复制代码
 npm install -g json-server

问题1、报--4048错误

会报如下错误 operation not permitted......errno: -4048code:'EPERM'syscall: 'mkdir'......The operation was reiected by your operating systemIt's possible that the file was already in use (by a text editor or antivirus).on that vou lack permissions to access it.

问题2、报ERR_SOCKET_TIMEOUT错误

...This is a problem related to network connectivity.

npm ERR! network In most cases you are behind a proxy or have bad network settings.

npm ERR! network

npm ERR! network If you are behind a proxy, please make sure that the

npm ERR! network 'proxy' config is set properly. See: 'npm help config'...

二、解决步骤

一开始以为是权限问题,本人根据提示路径找到node_modules文件,将文件权限勾选完全控制

但问题仍然存在!!!

1、解决报--4048错误问题方法参考链接1的评论区:

1)找到 C:\Users\{账户}\下的.npmrc 文件,删除.npmrc 文件

2)输入npm cache clean --force指令清除npm缓存:

复制代码
npm cache clean --force 

在使用npm cache clean --force 指令, 若反馈错误,可能是版本过高,可以输入:

复制代码
npm cache verify

本人在刚刚删除.npmrc的目录下空白地方打开终端, 输入npm cache verify指令通过了:

2、解决报ERR_SOCKET_TIMEOUT错误问题参考链接2

经过以上步骤,当本人再次在项目终端页面输入全局下载指令时,会卡在idealTree: timing idealTree Completed in 32944ms不动,最终报以下错误:

解决方法参考链接2的评论区:

换淘宝镜像源npm config set registry

当本人再再次输入全局下载指令时,通过了!

复制代码
npm config set registry

感谢链接这两篇文章,同时感谢评论区的大佬!!!

三、参考链接

1、npm-install 命令报错 -4048解决方案https://blog.csdn.net/weixin_44129867/article/details/126508964

2、npm install 卡在idealTree: timing idealTree Completed in 32944ms不动https://blog.csdn.net/weixin_48071078/article/details/132095789

相关推荐
Nerd(BUG版)2 小时前
Flutter学习day5--事件手势与命中测试
学习·flutter
Nerd(BUG版)4 小时前
KMP学习day4--Kotlin空安全与泛型
学习·安全·kotlin
東隅已逝,桑榆非晚4 小时前
算法6. 双指针法-查找总价格为目标的两个商品
c++·学习·算法
wdyan2975 小时前
带着小白学习-微服务-5 实战:配置中心-数据库连接
数据库·学习·微服务
叼烟扛炮5 小时前
Linux 学习笔记(五十):网络层——IP 协议、子网划分与 NAT 魔法
linux·笔记·学习
叼烟扛炮5 小时前
Linux 学习笔记(六十):单线程的逆袭——epoll 高并发服务器实战
linux·服务器·网络·笔记·学习·算法
Rabitebla7 小时前
【Linux操作系统】进程篇(十一):进程程序替换——从底层原理到 exec 函数族
linux·服务器·c++·笔记·学习·算法
叼烟扛炮8 小时前
[LangChain] 学习笔记(03):打破失忆症——对话机制与上下文管理
java·前端·javascript·笔记·学习·langchain
旖旎夜光8 小时前
【C++ 基础入门】类和对象(下):初始化列表、static 成员、友元与内部类
c++·笔记·学习
LONGZHIQIN8 小时前
STM32学习笔记
笔记·stm32·学习·arm