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

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

问题描述

我正在配置我的 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
  • 这是从管理命令提示符和管理电源外壳运行

这是代码

C:\WINDOWS\system32>npm install -g react-native-clinpm WARN npm npm 不支持 Node.js v10.15.3npm WARN npm 您可能应该像我们一样升级到较新版本的节点npm WARN npm 不能保证 npm 可以在这个版本上工作.npm WARN npm 支持的 Node.js 版本是 4、6、7、8 的最新版本.npm WARN npm 你可以在 https://nodejs.org/找到最新版本npm 错误!无法读取 null 的属性startsWith"npm 错误!可以在以下位置找到此运行的完整日志:

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

C:\WINDOWS\system32>npm cache clean -fnpm WARN npm npm 不支持 Node.js v10.15.3npm WARN npm 您可能应该像我们一样升级到较新版本的节点npm WARN npm 不能保证 npm 可以在这个版本上工作.npm WARN npm 支持的 Node.js 版本是 4、6、7、8 的最新版本.npm WARN npm 你可以在 https://nodejs.org/找到最新版本npm WARN 使用 --force 我当然希望你知道你在做什么.

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

C:\WINDOWS\system32>npm install -g npmnpm 警告 npm npm 不支持 Node.js v11.14.0npm WARN npm 您可能应该像我们一样升级到较新版本的节点npm WARN npm 不能保证 npm 可以在这个版本上工作.npm WARN npm 支持的 Node.js 版本是 4、6、7、8 的最新版本.npm WARN npm 你可以在 https://nodejs.org/找到最新版本npm 错误!无法读取 null 的属性startsWith"npm 错误!可以在以下位置找到此运行的完整日志:

C:\WINDOWS\system32>npm install -g npm-windows-upgradenpm 警告 npm npm 不支持 Node.js v11.14.0npm WARN npm 您可能应该像我们一样升级到较新版本的节点npm WARN npm 不能保证 npm 可以在这个版本上工作.npm WARN npm 支持的 Node.js 版本是 4、6、7、8 的最新版本.npm WARN npm 你可以在 https://nodejs.org/找到最新版本npm 错误!无法读取 null 的属性startsWith"npm 错误!可以在以下位置找到此运行的完整日志:

C:\WINDOWS\system32>npm install -g npm-windows-upgradenpm 警告 npm npm 不支持 Node.js v11.14.0npm WARN npm 您可能应该像我们一样升级到较新版本的节点npm WARN npm 不能保证 npm 可以在这个版本上工作.npm WARN npm 支持的 Node.js 版本是 4、6、7、8 的最新版本.npm WARN npm 你可以在 https://nodejs.org/找到最新版本npm 错误!无法读取 null 的属性startsWith"npm 错误!可以在以下位置找到此运行的完整日志:

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

解决方案

简单的解决方案是升级您的 npm 版本或第二个选项是降级您的节点版本.

从这里下载旧的节点版本

https://nodejs.org/en/download/releases/<块引用>

如何更新 npm?

npm install -g npm

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

您还可以通过执行 npm 更新所有过时的本地软件包通过执行 npm update 不带任何参数更新或全局包-g.

偶尔,npm 的版本会进步,以至于当前版本无法与您拥有的版本正确安装已经安装.(考虑一下,如果更新中存在错误命令.)在这些情况下,你可以这样做

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

I have installed the latest version of node.js when I type C:\WINDOWS\system32>node -v v11.14. is returned.

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

  • 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

This is the code

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:

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.

Edits The following code is a result of some of the proposed solutions

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:

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

解决方案

Simple solution is upgrade your npm version or second option is downgrade your node version.

Download older node version from here

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

How do I update npm?

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.

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

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

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

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