如何在 Windows 上更改 npm 的缓存路径(或完全禁用缓存)? [英] How can I change the cache path for npm (or completely disable the cache) on Windows?
问题描述
我已经在我的 Windows 7 x64 开发机器上安装了 Node.js,手动方式:
I've installed Node.js on my Windows 7 x64 development machine, the manual way:
mkdir C:Devel
odejs
cd C:Devel
odejs
set NODE_PATH=%CD%
setx /M PATH "%PATH%;%NODE_PATH%"
setx /M NODE_PATH "%NODE_PATH%
ode_modules"
我已经放置了主要的 node x64 二进制文件 和 npm 包管理器在 C:Devel
odejs
中.就像一个魅力一样工作,我可以更新主二进制文件而无需处理安装程序.
I've placed the main node x64 binary along with npm package manager in C:Devel
odejs
. Works like a charm and I can update the main binary without dealing with the installer.
我唯一无法解决的问题是移动缓存文件夹.当我安装本地包时:
The only problem I can't solve is moving the cache folder. When I install a local package:
npm install express
... 缓存位于 %APP_DATA%
pm-cache
文件夹下.我想把它改成:
... cache is placed under %APP_DATA%
pm-cache
folder. I'd like to change it to:
C:Devel
odejs
pm-cache
C:Devel
odejs
pm-cache
如何更改 npm 缓存文件夹或完全禁用它?
How can I change the npm cache folder, or disable it completely?
推荐答案
您可以使用 npm
命令行更改 npm 缓存文件夹.(参见 https://docs.npmjs.com/cli/v6/using-npm/config#cache)
You can change npm cache folder using the npm
command line. (see https://docs.npmjs.com/cli/v6/using-npm/config#cache)
所以你可能想试试这个命令:
So you might want to try this command :
> npm config set cache C:Devel
odejs
pm-cache --global
这篇关于如何在 Windows 上更改 npm 的缓存路径(或完全禁用缓存)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!