npm install Error: rollbackFailedOptional

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

    I tried following options to fix this issue and it worked.

    1. Uninstall Node.js version 8.
    2. Install Node.js version 6.11.4
    3. Use the registry option along with command to install any package.

    For example to install express I used following command.

    npm install express --registry http://registry.npmjs.org/
    

    or

    npm install express -g --registry http://registry.npmjs.org/
    

    If you want to install locally in any specific folder then use below command. Below command will install express on path C:\Sample\Example1 .

    C:\Sample1\Example1> npm install /Sample/Example1 express --registry http://registry.npmjs.org/
    

    Note: If you are installing locally in a specific location then first go to that directory using command and then run above command. If you are not inside that directory and giving only path in command that will not work.

    If you get package.json missing error then run below command before installing package locally

    C:\Sample\Example1> npm init
    

    above command will create package.json file. No need to provide any data. just hit enter.

    Note: If you are behind a firewall then you may need to set a proxy.

提交回复
热议问题