node_modules (节点_模块) 时出现报错

389 阅读1分钟

1. 问题描述

在vue项目中,当我们在终端使用指令:npm install 下载 node_modules (节点_模块) 时出现报错的情况。

node_modules是安装node后用来存放用包管理工具下载安装的包的文件夹。比如webpack、gulp、grunt这些工具。 111.png 主要是这个原因:npm ERR! Cannot read properties of null (reading 'pickAlgorithm')

翻译:npm错误!无法读取null的属性(读取“pickAlgorithm”)

2. 解决方案

在终端运行命令: npm cache clear --force(npm缓存清除--强制)

若是上条命令不行,则 npm cache clean --force   (npm缓存清理--强制)

一般来说运行完第一条命令,安装就成功了。但经过测试有些人的电脑上要使用缓存清理才行。

大家多多尝试。我自己用的 npm cache clear --force 效果很明显,一下就成功了。

然后再次执行命令进行安装:npm install(npm i)

再启动项目即可:npm run dev

总结

到此这篇关于npm ERR!Cannot read properties of null(reading 'pickAlgorithm')报错问题解决的文章就介绍到这了,原文来自于:https://www.jb51.net/article/277011.htm#_label1