npm install Error: rollbackFailedOptional

前端 未结 26 971
佛祖请我去吃肉
佛祖请我去吃肉 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

    In my case I had to edit the .npmrc directly and add the proxy settings manually.

    proxy=http://yourorganizationproxy.com:8080
    https-proxy=http://yourorganizationproxy.com:8080
    

    Hope this helps someone.

    0 讨论(0)
  • 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 $<installpath>/.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/<package> (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!

    0 讨论(0)
  • 2020-11-28 04:59
        # first this
        > npm config rm proxy
        > npm config rm https-proxy
    
        # then this
        > npm config set registry https://registry.npmjs.org/
    

    solved my problem.

    Again: Be sure to check whether you have internet connected properly.

    0 讨论(0)
  • 2020-11-28 05:00

    In some rarer occasions, check that the project can be built using regular npm commands. I ran into one that is configured to work with bower, so bower install <github_url> works while npm install <github_url> gives that unhelpful cryptic error message on all platforms...

    0 讨论(0)
  • 2020-11-28 05:00

    Try this all command answered here to solve the problem https://stackoverflow.com/a/54173142/12142401 if problem persists Do the following Steps

    Completely Uninstall the nodejs checkout this answer for complete uninstallation of nodejs https://stackoverflow.com/a/20711410/12142401

    Download the updated nodejs setup from their website Install it in any drive but not on previously installed drive like if you installed in C drive then install in D,S,G Drive Run your npm command it will completely work fine

    0 讨论(0)
  • 2020-11-28 05:06

    Most likely to be npm registry cannot be reached by npm. Check npm proxy configuration

    I had exactly the same issue on Windows Server 2008 R2. I suspected Internet Explorer's Enhanced Security Configuration at first but after turning that off with no success the issue turned out to be that npm was not configured to use my corporate proxy connection to the internet.

    It turns out that npm does not use the proxy settings in effect via Internet Options > Connections tab > LAN settings where the server is set to 'Automatically detect settings'. Being set to automatically detect settings does not guarantee that a proxy is indeed being used, it just means that Windows will automatically configure proxy settings for Internet Explorer if it finds a special'wpad.dat' file at http://wpad.[yourdomain.com]/wpad.dat.

    You can test whether a wpad.dat file is in use in your organisation by typing the following into a web browser.

    http://wpad.[yourcompany.domain]/wpad.dat
    

    If no file is available then it is likely you are not using an organization-wide proxy. If one does get returned to the browser then...

    Toward the bottom of this file, you should see a line saying

    PROXY <host:port>;
    

    It might be repeated if you have multiple proxies available. The host and port are needed in order to tell npm to use the proxy settings like so:

    npm config set proxy http://[host]:[port]
    

    and

    npm config set https-proxy http://[host]:[port]
    

    For example if your proxy is at my.proxy.com on port 8080 then the npm commands would be:

    npm config set proxy http://my.proxy.com:8080
    npm config set https-proxy http://my.proxy.com:8080
    

    Once I had told npm which proxy to use all started working in I was able to run the install commands without a problem.

    Thanks to the following post for help with the wpad file discovery.

    0 讨论(0)
提交回复
热议问题