mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Fallback to the local npm install if there are problems resolving the npm -g root path. [closes #122]
Former-commit-id: 1cbf807877e51198853950e5ebd1b49a6e20d123
This commit is contained in:
@@ -99,22 +99,28 @@
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
exec('npm -g root', function(exception, stdout) {
|
exec('npm -g root', function(exception, stdout) {
|
||||||
|
if (!exception) {
|
||||||
|
try {
|
||||||
|
var isGlobal = path.resolve(basePath, '..') == fs.realpathSync(stdout.trim());
|
||||||
|
} catch(e) {
|
||||||
|
exception = e;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (exception) {
|
if (exception) {
|
||||||
console.error([
|
console.error([
|
||||||
'There was a problem loading the npm registry. If you’re installing the Lo-Dash',
|
'Oops! There was a problem detecting the install mode. If you’re installing the',
|
||||||
'command-line executable (via `npm install -g lodash`), you’ll need to manually',
|
'Lo-Dash command-line executable (via `npm install -g lodash`), you’ll need to',
|
||||||
'install UglifyJS and the Closure Compiler by running:',
|
'manually install UglifyJS and the Closure Compiler by running:',
|
||||||
'',
|
'',
|
||||||
"curl -H 'Accept: " + mediaType + "' " + location.href + '/' + closureId + " | tar xvz -C '" + vendorPath + "'",
|
"curl -H 'Accept: " + mediaType + "' " + location.href + '/' + closureId + " | tar xvz -C '" + vendorPath + "'",
|
||||||
"curl -H 'Accept: " + mediaType + "' " + location.href + '/' + uglifyId + " | tar xvz -C '" + vendorPath + "'",
|
"curl -H 'Accept: " + mediaType + "' " + location.href + '/' + uglifyId + " | tar xvz -C '" + vendorPath + "'",
|
||||||
'',
|
'',
|
||||||
'Please submit an issue on the GitHub issue tracker: ' + process.env.npm_package_bugs_url + '.'
|
'Please submit an issue on the GitHub issue tracker: ' + process.env.npm_package_bugs_url
|
||||||
].join('\n'));
|
].join('\n'));
|
||||||
|
|
||||||
console.error(exception);
|
console.error(exception);
|
||||||
process.exit();
|
|
||||||
}
|
}
|
||||||
// exit early if not a global install
|
if (!isGlobal) {
|
||||||
if (path.resolve(basePath, '..') != fs.realpathSync(stdout.trim())) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// download the Closure Compiler
|
// download the Closure Compiler
|
||||||
|
|||||||
Reference in New Issue
Block a user