NPM Install giving rollbackFailedOptional

alexb.02 picture alexb.02 · Dec 30, 2018 · Viewed 10.2k times · Source

After trying to use the Windows Powershell (as an admin), the command prompt (as an admin) and the bash CMD; I repeatedly get the following error after trying an npm install command:

npm install npm@latest -g

is the attempted command and...

[...] / rollbackFailedOptional: verb npm-session xxxxxxxxxxx

where the 'x's represent different letter and number combinations at each attempt, is the message. I am aware that this should be the first step in the installation of a package but it remains on this message for a long time and will not change.

I am trying to use the JavaScript React library, more specifically the 'create-react-app'. The npm install -g create-react-app command is also causing the error.

npm version: 6.5.0

npx version: 10.2.0

node version: 10.15.0

A solution would be greatly appreciated.

Answer

Pedro Silva picture Pedro Silva · Dec 30, 2018

https://docs.npmjs.com/try-the-latest-stable-version-of-npm In this link there is the documentation for updating npm version for windows with a link to a tool developed by Microsoft to update npm (https://github.com/felixrieseberg/npm-windows-upgrade)