mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 07:47:49 +00:00
Fix installation mode detection on Windows. Closes #139.
The global `node_modules` directory does not exist if no modules have been installed globally, causing `realpathSync` to throw an exception. Former-commit-id: 5a59e6b53c7afe5d5c5728352e9cd722744b2247
This commit is contained in:
@@ -25,6 +25,9 @@
|
||||
/** The media type for raw blob data */
|
||||
var mediaType = 'application/vnd.github.v3.raw';
|
||||
|
||||
/** Reassign `existsSync` for older versions of Node */
|
||||
fs.existsSync || (fs.existsSync = path.existsSync);
|
||||
|
||||
/** Used to reference parts of the blob href */
|
||||
var location = (function() {
|
||||
var host = 'api.github.com',
|
||||
@@ -101,7 +104,8 @@
|
||||
exec('npm -g root', function(exception, stdout) {
|
||||
if (!exception) {
|
||||
try {
|
||||
var isGlobal = path.resolve(basePath, '..') == fs.realpathSync(stdout.trim());
|
||||
var root = stdout.trim(),
|
||||
isGlobal = fs.existsSync(root) && path.resolve(basePath, '..') == fs.realpathSync(root);
|
||||
} catch(e) {
|
||||
exception = e;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user