Skip to content

Commit f5f13cb

Browse files
committed
lib: ignore non-critical os.userInfo() failures
Fixes: #1834
1 parent bacf53d commit f5f13cb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/install.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,12 @@ function install (fs, gyp, argv, callback) {
370370
}
371371
var tmpdir = os.tmpdir()
372372
gyp.devDir = path.resolve(tmpdir, '.node-gyp')
373-
log.warn('EACCES', 'user "%s" does not have permission to access the dev dir "%s"', os.userInfo().username, devDir)
373+
var userString = ''
374+
try {
375+
// os.userInfo can fail on some systems, it's not critical here
376+
userString = ` ("${os.userInfo().username}")`
377+
} catch (e) {}
378+
log.warn('EACCES', 'current user%s does not have permission to access the dev dir "%s"', userString, devDir)
374379
log.warn('EACCES', 'attempting to reinstall using temporary dev dir "%s"', gyp.devDir)
375380
if (process.cwd() === tmpdir) {
376381
log.verbose('tmpdir == cwd', 'automatically will remove dev files after to save disk space')

0 commit comments

Comments
 (0)