异常
D:\NodeJs\node-demo>npm install --save mysql
npm WARN npm npm does not support Node.js v17.1.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, 12.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN npm npm does not support Node.js v17.1.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, 12.
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\Administrator\AppData\Roaming\npm-cache\_logs\2021-11-11T15_03_55_859Z-debug.log
原因
npm版本与node版本不匹配。在错误提示中也说了npm does not support Node.js v17.1.0 ,npm不支持17.1.0版本的node.js。
解决
升级npm版本,或者降低noe.js版本。反正二者要相互匹配。
查看它们的之间的关系:https://nodejs.org/zh-cn/download/releases/
这里采用的方法是更新npm版本,执行如下命令:
npm install -g npm
npm install -g cnpm
注意,我这里使用npm install -g npm 安装失败 所以使用了cnpm install -g npm 来进行安装 安装成功后查看npm版本,就匹配了。
|