npm 版本不支持node.js的解决方法
今天在npm安装http-server 发现命令窗口报错,出现npm不支持node版本,也就是说需要升级npm版本
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
1.*首先需要cmd 命令窗口 查看node,npm版本,分别使用 node -v,npm-v 查看版本
然后根据自己的node版本来更新npm 版本
npm -g install npm@6.14.8
如果仍然报错,依旧显示npm 不支持这个版本 ,这说明npm存在旧的npm缓存,还是旧的npm 环境
此时需要到C:\Users\pc\AppData\Roaming 根目录下
删除npm, npm-cache两 个文件
如图
然后执行 npm -g install npm@6.14.8
这时不会出现报错