From 1186e893264458646e602c48aa2c860da7a7f830 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Sat, 20 Jul 2019 15:03:56 +1000 Subject: [PATCH] lib: ignore non-critical os.userInfo() failures Fixes: https://github.com/nodejs/node-gyp/issues/1834 PR-URL: https://github.com/nodejs/node-gyp/pull/1835 --- lib/install.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/install.js b/lib/install.js index 6ac8519ef5..83a322debc 100644 --- a/lib/install.js +++ b/lib/install.js @@ -370,7 +370,12 @@ function install (fs, gyp, argv, callback) { } var tmpdir = os.tmpdir() gyp.devDir = path.resolve(tmpdir, '.node-gyp') - log.warn('EACCES', 'user "%s" does not have permission to access the dev dir "%s"', os.userInfo().username, devDir) + var userString = '' + try { + // os.userInfo can fail on some systems, it's not critical here + userString = ` ("${os.userInfo().username}")` + } catch (e) {} + log.warn('EACCES', 'current user%s does not have permission to access the dev dir "%s"', userString, devDir) log.warn('EACCES', 'attempting to reinstall using temporary dev dir "%s"', gyp.devDir) if (process.cwd() === tmpdir) { log.verbose('tmpdir == cwd', 'automatically will remove dev files after to save disk space')