温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》
  • 首页 > 
  • 教程 > 
  • 开发技术 > 
  • npm install编译时报"Cannot read properties of null (reading ‘pickAlgorithm‘)"错误如何解决

npm install编译时报"Cannot read properties of null (reading ‘pickAlgorithm‘)"错误如何解决

发布时间:2022-07-22 11:52:25 来源:亿速云 阅读:1761 作者:iii 栏目:开发技术

这篇文章主要介绍“npm install编译时报"Cannot read properties of null (reading ‘pickAlgorithm‘)"错误如何解决”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“npm install编译时报"Cannot read properties of null (reading ‘pickAlgorithm‘)"错误如何解决”文章能帮助大家解决问题。

先看报错:

npm install编译时报"Cannot read properties of null (reading ‘pickAlgorithm‘)"错误如何解决

先说下网上大多数的解决方案:

方案一:

重新安装node解决

方案二:

删了node models重新下

或者直接下载CNPM(淘宝镜像)进行安装 CNPM安装办法

npm install -g cnpm -registry=https://registry.npm.taobao.org

查看cnpm是否真安装成功 cnpm -v

方案三:

清除缓存npm cache clear --force之后再重新安装依赖npm install

我的解决方案

基本上都是以上这三种方法,先说下我的项目为什么会出现这种报错,项目原先用的node13和14的版本,然后我们将node 升到16后发现原先的所有项目都编译不了了,全报这种错误。

测试的时候遇到的假象,当将node13升到16的时候,重新编译,编译是正常的,但是后来发现当node_modules 删除后重新编译就会出现上面的错,原因可能是我们node13编译的node_modules没有删除,项目一直读的node13编译的东西,给我们以为我们安装的node16是成功的。

遇到这类问题,牵扯到node升级,以上的解决方案并没能解绝。

最后解决方案,找到package-lock.json文件。将图中圈红的内容保留,其余的全部删除,然后npm install重新编译,package-lock.json会生成一份新的文件。最后编译成功。得以解决。

npm install编译时报"Cannot read properties of null (reading ‘pickAlgorithm‘)"错误如何解决

关于“npm install编译时报"Cannot read properties of null (reading ‘pickAlgorithm‘)"错误如何解决”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识,可以关注亿速云行业资讯频道,小编每天都会为大家更新不同的知识点。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI