2

I am on Windows 10. I upgraded my npm by doing a npm i -g npm.

However no package is installing or uninstallating. On install it is hanging always on postinstall like this:

PS C:\Users\Mercurius\Documents\GitHub\catchem-front> npm i --save immutable [ ......] \ postinstall: info lifecycle immutable@3.8.1~postinstall: > immutable@3.8.1

Here is a screenshot:

On uninstall it hangs/fails on:

PS C:\WINDOWS\system32> cd C:\Users\Mercurius\Documents\GitHub\catche PS C:\Users\Mercurius\Documents\GitHub\catchem-front> npm un --save c [ ......] \ postinstall: sill doSerial postinstall 894

This was me trying to run it as administrator in powershell, but same problem. It ends up giving me some unlink error and tells me to try admin mode:

I then got npm-windows-upgrade and followed here - https://stackoverflow.com/a/31520672/1828637

I even downloaded the latest node msi installer and upgraded to 8.5 but still getting this hang on postinstall..

However still having this issue. I think I used npm-windows-upgrade a long time ago, and they warn not to use npm i -g npm anymore, which I just found out, do you think this is the issue?

Noitidart
  • 35,443
  • 37
  • 154
  • 323
  • Try to use `nvm` to manage the version of node & npm. – Eric Sep 07 '17 at 04:23
  • `nvm` doesnt work on windows, I used it succefsully on linux and macs though. Thanks for the idea though @EricWang – Noitidart Sep 07 '17 at 04:25
  • For windows, there is a similar tool written in go. https://github.com/coreybutler/nvm-windows – Eric Sep 07 '17 at 04:26
  • npm 5.4.0 and 5.4.1 just wouldnt work no matter what, i had to reinstall node with and leave the npm version that came with it. – Noitidart Sep 13 '17 at 21:16
  • If you must use windows machine, maybe it's better to create a vm using virtualbox, that's my first choice when working in a company that must use windows as dev machine. – Eric Sep 14 '17 at 10:53

1 Answers1

2

NPM 5.4.0 and 5.4.1 have issues, You have 2 options one is to downgrade the current version

npm i -g npm@5.3.0

or the following which is to re-install with --no-optional flag which will prevent optional dependencies from being installed which seems to be the problem,

npm i -g npm@5.3.0
npm cache clean --force
npm install --no-optional

First method will work, second I have not tried it but should work theoretically.

Kalana Demel
  • 3,220
  • 3
  • 21
  • 34
  • 1
    Thanks very much, I had ended up re-installing with the installer from node's website. I am now currently on 5.4.2 and it seems to work. – Noitidart Sep 23 '17 at 07:40
  • @noitidart hey could you put the exact commands please. I'm stuck unable to install npm. I want npm 5.4.2 with node 8.x installed – kRazzy R Nov 09 '17 at 22:00
  • @kRazzyR I actually used the Windows installer from the nodejs.org website, so I had no commands. – Noitidart Nov 09 '17 at 22:04