ReactJS中执行npm install时出现Cannot read properties of null (reading 'pickAlgorithm')错误
npm全局安装netlify-cli报错
Cannot read properties of null (reading 'pickAlgorithm')解决方法 问题场景
执行全局安装netlify-cli命令:
npm install -g netlify-cli
触发错误,完整错误信息:
npm WARN deprecated statsd-client@0.4.7: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. 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\HP\AppData\Local\npm-cache\_logs\2022-09-13T23_14_47_800Z-debug-0.log
环境信息
- 操作系统:Windows 10
- ReactJS版本:18.2.0
- Node版本:16.17.0
- npm版本:8.17.0
解决方案
- 清理npm缓存后重试安装
依次执行命令:npm cache clean --force npm install -g netlify-cli - 切换npm镜像源
先配置国内镜像源:
再重新运行安装命令npm config set registry https://registry.npmmirror.com - 手动删除缓存目录
找到路径C:\Users\HP\AppData\Local\npm-cache,删除整个缓存文件夹后,再次执行安装命令 - 调整版本兼容性
当前Node 16.x与npm 8.x属于兼容组合,若以上方法无效,可尝试将npm降级至8.16.x稳定版,或升级Node到16.x系列最新小版本后重试
内容的提问来源于stack exchange,提问作者kalx11
相关产品推荐
相关产品推荐

