1.打開cmd命令行,查看當前配置
輸入 npm config ls
先看一下當前npm的配置環境,由於我已經修改過,所以可以看到修改后的路徑


2.修改路徑
這里需要修改兩個路徑,module路徑和cache路徑
module對應prefix
cache對應cache
首先在別的盤新建兩個目錄
D:\nodejs\node_modules\npm\node_global_modules
D:\nodejs\node_modules\npm\node_cache
然后依次執行
npm config set prefix="D:\nodejs\node_modules\npm\node_global_modules"
npm config set cache="D:\nodejs\node_modules\npm\node_cache"
