How to restore/reset npm configuration to default values?

前端 未结 6 861
孤街浪徒
孤街浪徒 2020-12-04 09:32

I have played with npm set and npm config set for several times, now I want to reset to default values (a kind of factory reset).

D

6条回答
  •  臣服心动
    2020-12-04 10:06

    To reset user defaults

    Run this in the command line (or git bash on windows):

    echo "" > $(npm config get userconfig)
    npm config edit
    

    To reset global defaults

    echo "" > $(npm config get globalconfig)
    npm config --global edit
    

    If you need sudo then run this instead:

    sudo sh -c 'echo "" > $(npm config get globalconfig)'
    

提交回复
热议问题