File tree Expand file tree Collapse file tree 1 file changed +7
-15
lines changed Expand file tree Collapse file tree 1 file changed +7
-15
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
const npmrc = require ( './npmrc' ) ;
3
- const exec = require ( 'mz/child_process' ) . exec ;
4
3
5
4
var argv ;
6
5
try {
9
8
argv = process . argv ;
10
9
}
11
10
12
- // 查找npmrc文件路径
13
- exec ( 'npm config get globalconfig' ) . then ( result => {
14
- var configFile = result [ 0 ] && result [ 0 ] . trim ( ) ;
15
- if ( ! configFile ) {
16
- throw result [ 1 ] ;
11
+ npmrc ( argv , process . env . npm_config_globalconfig ) . catch ( e => {
12
+ if ( e . code === 'EACCES' || / \b p e r m i s s i o n s ? \b / i. test ( e . message ) ) {
13
+ console . error ( e . message ) ;
14
+ console . error ( 'Please try running this command again as root/Administrator.' ) ;
15
+ } else {
16
+ console . error ( e ) ;
17
17
}
18
- return npmrc ( argv , configFile ) . catch ( e => {
19
- if ( e . code === 'EACCES' || / \b p e r m i s s i o n s ? \b / i. test ( e . message ) ) {
20
- console . error ( e . message ) ;
21
- console . error ( 'Please try running this command again as root/Administrator.' ) ;
22
- } else {
23
- console . error ( e ) ;
24
- }
25
- process . exitCode = 1 ;
26
- } ) ;
18
+ process . exitCode = 1 ;
27
19
} ) ;
You can’t perform that action at this time.
0 commit comments