NPM 警告 notsup 不支持 gatsby-plugin 引擎

NPM Warning notsup Unsopported engine for gatsby-plugin

当 运行 命令 npm install gatsby-plugin-google-tagmanager

时出现以下错误

我尝试通过 运行 npm update -g 更新 npm 版本,但是当我检查它时,它仍然是“6.14.6”。

如有任何帮助,我们将不胜感激。

npm WARN notsup Unsupported engine for gatsby-plugin-google-tagmanager@3.4.0: wanted: {"node":">=12.13.0"} (current: {"node":"10.22.0","npm":"6.14.6"})
npm WARN notsup Not compatible with your version of node/npm: gatsby-plugin-google-tagmanager@3.4.0
npm WARN gatsby-plugin-google-tagmanager@3.4.0 requires a peer of gatsby@^3.0.0-next.0 but none is installed. You must install peer dependencies yourself.
npm WARN gatsby-plugin-google-tagmanager@3.4.0 requires a peer of react@^16.9.0 || ^17.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN gatsby-plugin-google-tagmanager@3.4.0 requires a peer of react-dom@^16.9.0 || ^17.0.0 but none is installed. You must install peer dependencies yourself.

+ gatsby-plugin-google-tagmanager@3.4.0
updated 1 package and audited 3 packages in 0.68s
found 0 vulnerabilities

需要更新的不是 npm,而是 Node.js。您正在使用 运行ning Node.js 10.22.0,但软件包 gatsby-plugin-google-tagmanager@3.4.0 需要 Node.js 12.13.0 或更高版本。

鉴于对 Node.js 10.x 的支持已于几天前(2021 年 4 月 30 日)结束,这是更新的另一个原因。目前,我建议更新到 14.x,这是最新的 LTS(长期支持)版本。 12.x 没问题,但会再支持 12 个月。 (14.x 将再支持 24 个月。16.x 将再支持 36 个月,但直到 10 月才正式成为 LTS 版本,因此它可能会发生很多本来不会发生的变化在 LTS 版本中。)

还值得注意的是,该软件包确实已安装。您收到了关于 Node.js 版本的警告,但不是错误。不过,我不建议尝试 运行 带有 Node.js 版本的包,它说它不支持。