zl程序教程

您现在的位置是:首页 >  其他

当前栏目

npm 安装报错:Cannot read property ‘pickAlgorithm‘ of null

安装npm 报错 of Cannot null Read Property
2023-09-14 09:14:05 时间

问题:

npm 安装报错:Cannot read property ‘pickAlgorithm‘ of null

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\XXX\AppData\Local\npm-cache\_logs\2022-06-22T09_17_21_151Z-debug-0.log

解决:

1.首先windows+R,输入cmd 进入命令窗口 ,输入npm install,查看报错信息,很明显版本不匹配;

npm WARN npm npm does not support Node.js v14.14.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can’t make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\pc\AppData\Roaming\npm-cache_logs\2020-10-23T08_30_48_208
Z-debug.log
 

2.命令窗口执行npm install npm -g,然后输入node -vnpm -v,查看node和npm的版本;

3.以往的版本 | Node.js,进入查看node和npm匹配版本分别是多少;

4.然后根据自己的node版本来更新npm 版本,降低或提高版本
npm -g install npm@6.13.4

5.如果还是显示npm 不支持这个版本,需要到C:\Users\pc\AppData\Roaming 根目录下
删除npm, npm-cache两 个文件

然后执行: npm -g install npm@6.13.4