gpt4 book ai didi

node.js - 如何在 Windows 上修复 'npm does not support Node.js v11.14.0 error'?

转载 作者:行者123 更新时间:2023-12-05 01:40:52 26 4
gpt4 key购买 nike

我正在配置我的 react-native 环境。我正在尝试按照 Facebook 的 Github 文档 here 中的描述运行 react-native 命令行

当我输入 C:\WINDOWS\system32>node -v v11.14. 时,我已经安装了最新版本的 node.js。

下载的 npm 包含在最新版本的 node.js 中。但是它只有 5.5.1。当我输入 C:\WINDOWS\system32>npm -v 结果是 5.5.1

  • 我试过卸载并重新安装
  • 我已经尝试下载 node.js 的 LTS 版本
  • 我已经尝试升级 node.js 和 npm
  • 这适用于 Windows 10
  • 这是从管理命令提示符和管理电源 shell 运行的

这是代码

C:\WINDOWS\system32>npm install -g react-native-cli
npm WARN npm npm does not support Node.js v10.15.3
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 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! Cannot read property 'startsWith' of null

npm ERR! A complete log of this run can be found in:

当我尝试使用 npm cache clean -f 清理缓存时,结果是这样

C:\WINDOWS\system32>npm cache clean -f
npm WARN npm npm does not support Node.js v10.15.3
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 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN using --force I sure hope you know what you are doing.

编辑以下代码是一些建议解决方案的结果

C:\WINDOWS\system32>npm install -g npm
npm WARN npm npm does not support Node.js v11.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 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! Cannot read property 'startsWith' of null

npm ERR! A complete log of this run can be found in:
C:\WINDOWS\system32>npm install -g npm-windows-upgrade
npm WARN npm npm does not support Node.js v11.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 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! Cannot read property 'startsWith' of null

npm ERR! A complete log of this run can be found in:
C:\WINDOWS\system32>npm install -g npm-windows-upgrade
npm WARN npm npm does not support Node.js v11.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 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! Cannot read property 'startsWith' of null

npm ERR! A complete log of this run can be found in:

我希望打开 npm 命令行界面。我在尝试调用接口(interface)时收到错误消息。

最佳答案

安装当前的 NodeJS LTS 后,我仍然得到npm 不支持 Node.js {版本}

我删除了 C:\Users\{user}\AppData\Roaming\npm\ 中的所有文件并且它有效。

关于node.js - 如何在 Windows 上修复 'npm does not support Node.js v11.14.0 error'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55678569/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com