0

I had installed the latest version of node.js version 10.16.3 and had the latest version of npm version 6.9.0

I am currently following a course on node.js and the instructor recommended to downgrade to npm version 5.5.1 to have the same version as him for the course so I did that.

Now version 5.5.1 is not supported in the latest release of node.js and if I try to run any npm commands including updating the version globally it throws the same error as shown below.

I have already tried the following:

Running npm i -g npm@latest which throws the same error as below. Basically any npm command throws that error

Completely uninstalling and reinstalling node.js however the version of npm is still 5.5.1 and not the latest

This is the error message that I get when running any npm command

npm WARN npm npm does not support Node.js v10.16.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/
WARNING: You are likely using a version of node-tar or npm that is incompatible with this version of Node.js.
Please use either the version of npm that is bundled with Node.js, or a version of npm (> 5.5.1 or < 5.4.0) or node-tar (> 4.0.1) that is compatible with Node.js 9 and above.
npm[5864]: c:\ws\src\node_zlib.cc:551: Assertion `args.Length() == 7 && "init(windowBits, level, memLevel, strategy, writeResult, writeCallback," " dictionary)"' failed.



1: 00007FF7DC7ADD8A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4506
 2: 00007FF7DC788886 node::MakeCallback+4534
 3: 00007FF7DC78893F node::MakeCallback+4719
 4: 00007FF7DC6E791D RSA_meth_get_flags+93021
 5: 00007FF7DCCB5BF2 std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+79442
 6: 00007FF7DCCB707D std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+84701
 7: 00007FF7DCCB60D6 std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+80694
 8: 00007FF7DCCB5FBB std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+80411
 9: 000001F722E5C5C1
Harleym7000
  • 81
  • 1
  • 3

2 Answers2

1

I have run into the exact same problem when following the same course. I managed to fix it by uninstalling node as well as all npm files on the machine, and reinstalling node from scratch. Specifically, I managed to uninstall node and npm by following this answer.

How to completely remove node.js from Windows

Dharman
  • 30,962
  • 25
  • 85
  • 135
Yassine
  • 33
  • 5
0

i very strongly recommend to all developers who use node, to use nvm

we use nvm to very quickly switch which version of node we're using

after you use nvm to install your favorite version of node, you can upgrade npm easily with npm itself, like so

npm install -g npm@latest

instead of latest, you can specify an exact version number, like so

npm install -g npm@5.5.1

edit: i just re-read your post and see that you're specifically having troubles installing that old verison of npm with that specific version of node

consider just using whichever version of npm that particular version of node uses

also, poke and prod your instructor to "get with it", there is no excuse — using unsupported software, ESPECIALLY npm, is a TERRIBLE idea because of gaping security holes in older versions

this is software that downloads and auto-executes thousands of open source software packages, almost without any security measures -- you'd better be doing this in a throwaway virtualmachine if you're going to be using unpatched old versions of this software

again, you should shame your instructor about this, and educate them about the importance of staying on supported channels, and how to use nvm to make it easy as cake

cheers

Chase

ChaseMoskal
  • 7,151
  • 5
  • 37
  • 50
  • Thank you so much for your response. Using nvm has resolved the issue. The steps taken are outlined below: 1. Download nvm-install zip file form the github repository 2. Run the .exe file to install nvm 3. Use nvm to revert your version of node to a version that supports version 5.5.1 of npm e.g. version 8.12.0 of node 4. Once reverted run the npm i -g npm@latest command Many thanks for your help! – Harleym7000 Sep 08 '19 at 00:06