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

标签 node.js npm command-line npm-install

我正在配置我的 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/

相关文章:

javascript - 请求的 URL "[no URL]"无效。 Node http-proxy

node.js - 在 NodeJS 中异步使用同步进程

javascript - 我可以将 writeStream.bytesWritten 与管道一起使用吗?

javascript - 如何在不了解 Node/Browserify/npm 等知识的情况下使 Docxtemplater.js 在浏览器上工作?

node.js - NPM install -g cordova ionic 给出 Err -13

php - 通过命令提示符执行 PHP5 脚本时是否可以读取 cookie/session 值?

javascript - 如何在 while 循环中串联连接 Promise

javascript - 如何从 react native 链接中排除包?

bash - bash中while循环的 bool 类型?

Python 错误 : subprocess. CalledProcessError:命令返回非零退出状态 1