如何在Windows上修复'npm不支持Node.js v11.14.0错误'? [英] How to fix 'npm does not support Node.js v11.14.0 error' on Windows?

查看:725
本文介绍了如何在Windows上修复'npm不支持Node.js v11.14.0错误'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在配置我的本机环境。我正在尝试按照Facebook Github文档中的此处所述运行react-native命令行。

I am configuring my react-native environment. I am attempting to run the react-native command line as described in Facebook's Github documentation here

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

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

The npm downloaded was included with the latest version of node.js. However it is only 5.5.1. When I input C:\WINDOWS\system32>npm -v the result is 5.5.1


  • 我尝试卸载并重新安装

  • 我尝试下载节点的LTS版本。 js

  • 我试图同时升级node.js和npm

  • 这是针对Windows 10的

  • 这是从管理命令提示符和管理电源外壳运行的

  • I've tried to uninstall and reinstall
  • I've tried to download the LTS version of node.js
  • I've tried to upgrade both node.js and npm
  • This is for Windows 10
  • This is running from the administrative command prompt and administrative power 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缓存清理-f 这是结果

When I attempt to clean the cache with npm cache clean -f this is the result

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命令行界面。

I expect to open the npm command line interface. I am receiving errors when I attempt to call the interface.

推荐答案

简单的解决方案是升级您的npm版本或第二种选择正在降级您的节点版本。

从此处下载较旧的节点版本

Download older node version from here

https://nodejs.org/en/download/releases/


如何更新npm?

npm install -g npm

请注意,此命令将删除您当前的npm版本。
如果在Mac上,请确保使用sudo npm install -g npm。

Please note that this command will remove your current version of npm. Make sure to use sudo npm install -g npm if on a Mac.

您还可以通过执行npm
update来更新所有过时的本地软件包。不需要任何参数,也可以通过执行npm update
-g来全局打包。

You can also update all outdated local packages by doing npm update without any arguments, or global packages by doing npm update -g.

有时,npm的版本会进展为当前的
版本无法与已经安装
的版本一起正确安装。 (考虑一下,如果update
命令中存在错误。)在这种情况下,您可以这样做

Occasionally, the version of npm will progress such that the current version cannot be properly installed with the version that you have installed already. (Consider, if there is ever a bug in the update command.) In those cases, you can do this

这篇关于如何在Windows上修复'npm不支持Node.js v11.14.0错误'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆