npm install Error: rollbackFailedOptional

前端 未结 26 987
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-28 04:26

When I try npm install new packages it shows me this error:

rollbackFailedOptional: verb npm-session 585aaecfe5f9a82

<
26条回答
  •  感情败类
    2020-11-28 04:58

    Struggled with this issue for some time before figuring it out.
    I'm using High Sierra (10.13.6)
    Uninstalled and re-installed node and nvm multiple times - using the installer.pkg, HomeBrew, and then using the command line. IMO, the command line works the best.

    I followed these steps:
    1. Ran npm config ls -l
    2. Checked that the value for globalconfig was $/.nvm/versions/node/v12.16.3/etc/npmrc But when I tried to get to this path in the Terminal, it gave me No such file or directory
    So I
    3. created the folder etc, created the npmrc file and added this line in it.

    registry = "https://registry.npmjs.org/"
    


    I do not have the ~/.npmrc file in my $HOME

    Then
    4. I re-ran the npm install command.


    Note that this still threw the rollbackFailedOptional: verb npm-session error, but this time it completed, though with a different error. You could try these steps and see if it works.

    For those who are curious, it threw a Response timeout while trying to fetch https://registry.npmjs.org/ (over 30000ms) error, so I added the timeout = "60000" to the /etc/npmrc file (as found on another Stackoverflow thread), and tried again. This worked for me.

    Hope this helps!

提交回复
热议问题