经过几天的调查,我找到了一个变通解决方案:我创建了一个代理PHP脚本,它将作为主注册表的包装器
https://registry.npmjs.org
npm config set registry YOUR_PROXY_HOSTED_PATH/proxy/
代理脚本
<?php
$url=$_GET['url'];
if($url){
$file = file_get_contents('https://registry.npmjs.org/'.$url);
//Locating and Replacing
$file = str_replace('https://registry.npmjs.org/','YOUR_PROXY_HOSTED_PATH/index.php?url=',$file);
die($file);
}
?>
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^proxy/([^/]+) /index.php?url=$1 [NC]