How to fix 'npm does not support Node.js v11.14.0 error' on Windows?

这一生的挚爱 提交于 2019-12-13 04:43:59

问题


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.


回答1:


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




回答2:


npm install -g npm-windows-upgrade
npm-windows-upgrade



回答3:


You are using an old version of npm. Please upgrade it to the latest.




回答4:


I deleted node and npm from C:\Users{name}\AppData\Roaming. Then i reinstalled an older version node.js v10.15.3 and npm 6.4.1.

This brings up a different error so I'll be closing this issue...

C:\>npm install -g expo-cli
npm ERR! Cannot read property 'startsWith' of null

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\dnort\AppData\Roaming\npm-cache\_logs\2019-04-15T06_32_09_154Z- 

debug.log




回答5:


I faced the same issue using npm, so I was thinking about the alternative of npm. And, you might give the yarn a try.

Firstly, going to https://nodejs.org/en/ to download the nodejs with the LTS version.

Secondly, going to https://yarnpkg.com to download the msi file with the stable version.

Note that the current version of nodejs and yarn are 10.16.0 LTS and 1.17.3 respectively. After installation, you can install your project packages by using yarn install instead of npm install.



来源:https://stackoverflow.com/questions/55678569/how-to-fix-npm-does-not-support-node-js-v11-14-0-error-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!