Skip to content

Commit 44bfd83

Browse files
committed
feat: 支持 npm 私有仓库配置为 http 形式
1 parent e52750e commit 44bfd83

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

modules/utils/npm.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import url from 'url';
22
import https from 'https';
3+
import http from 'http';
34
import gunzip from 'gunzip-maybe';
45
import { LRUCache } from 'lru-cache';
56

@@ -37,7 +38,12 @@ const notFound = '';
3738

3839
function get(options) {
3940
return new Promise((accept, reject) => {
40-
https.get(options, accept).on('error', reject);
41+
if (npmRegistryURL.startsWith('http://')) {
42+
delete options.agent;
43+
http.get(options, accept).on('error', reject);
44+
} else {
45+
https.get(options, accept).on('error', reject);
46+
}
4147
});
4248
}
4349

0 commit comments

Comments
 (0)