From e2027939f396c479b4531f4fbf5c38263f8417cd Mon Sep 17 00:00:00 2001 From: Dr Date: Fri, 15 Jan 2021 00:27:02 +0800 Subject: [PATCH] [Windows] use `npm config` instead of `npm_config_cache` (#2153) The `npm_config_cache` env, if set, will have highest priority, and harder to change. One way to un-set this is add a global workflow env, like: ``` env: npm_config_cache: '' ``` This commit change the cache config to use `npm config set cache $CachePath --global`, which should save the path under the global npmrc at: `C:\npm\prefix\etc\npmrc`, and allow easier later reset with user/repo level `.npmrc` files. For the record, my usage is to unify all platform's npm cache to `~/.npm/`, then use the same cache action config on all platform to cache the folder. --- images/win/scripts/Installers/Install-NodeLts.ps1 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/images/win/scripts/Installers/Install-NodeLts.ps1 b/images/win/scripts/Installers/Install-NodeLts.ps1 index a44a04fb..4c1b9d27 100644 --- a/images/win/scripts/Installers/Install-NodeLts.ps1 +++ b/images/win/scripts/Installers/Install-NodeLts.ps1 @@ -18,9 +18,7 @@ $env:Path = Get-MachinePath setx npm_config_prefix $PrefixPath /M $env:npm_config_prefix = $PrefixPath -setx npm_config_cache $CachePath /M -$env:npm_config_cache = $CachePath - +npm config set cache $CachePath --global npm config set registry http://registry.npmjs.org/ npm install -g cordova