本文最后更新于:2023年12月5日 下午

当本地 npm 包版本与项目配置不一致时经常出现各种引用错误,本文记录解决方案。

问题复现

  • 在已经配置好的 npm 环境种,修改 package.json 后经常产生错误:
1
2
3
4
5
npm ERR! Cannot read properties of null (reading 'pickAlgorithm')

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Local\npm-cache\_logs\2022-07-04T01_55_30_086Z-debug-0.log

解决方案

  • 清除缓存npm cache clear --force之后再重新安装依赖npm install
1
2
npm cache clear --force
npm install
  • 若出现端口号冲突

    1、关闭该端口的进程;

    2、通过 npm serve --port 4201 指定端口号打开

参考资料



文章链接:
https://www.zywvvd.com/notes/coding/node-js/npm-cantread-error/npm-cantread-error/


“觉得不错的话,给点打赏吧 ୧(๑•̀⌄•́๑)૭”

微信二维码

微信支付

支付宝二维码

支付宝支付

NPM - Cannot read properties of null (reading 'pickAlgorithm') 解决方案
https://www.zywvvd.com/notes/coding/node-js/npm-cantread-error/npm-cantread-error/
作者
Yiwei Zhang
发布于
2022年7月4日
许可协议