diff options
author | isaacs <i@izs.me> | 2012-06-04 11:21:42 -0700 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-06-04 17:32:59 -0700 |
commit | cc36cc5999937aeb0ed00f82b5c969edecaa1b1d (patch) | |
tree | 5479addcba6a7a5ee19682d1531727cff6e40311 | |
parent | 4f6882e8982aeee8065803e93acb2c6f0dff8d1d (diff) | |
download | node-new-cc36cc5999937aeb0ed00f82b5c969edecaa1b1d.tar.gz |
build: Don't clobber symlinked npm
-rw-r--r-- | tools/installer.js | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/tools/installer.js b/tools/installer.js index 96c992edb6..0aeb1daeca 100644 --- a/tools/installer.js +++ b/tools/installer.js @@ -126,12 +126,23 @@ if (cmd === 'install') { // Install npm (eventually) if (variables.node_install_npm) { - copy('deps/npm', 'lib/node_modules/npm'); - queue.push('ln -sf ../lib/node_modules/npm/bin/npm-cli.js ' + - path.join(dest_dir, node_prefix, 'bin/npm')); - queue.push([shebang, '#!' + path.join(node_prefix, 'bin/node'), - path.join(dest_dir, node_prefix, - 'lib/node_modules/npm/bin/npm-cli.js')]); + // Frequently, in development, the installed npm is a symbolic + // link to the development folder, and so installing this is + // a bit annoying. If it's a symlink, skip it. + var isSymlink = false; + try { + var st = fs.lstatSync(path.resolve(node_prefix, 'lib/node_modules/npm')); + isSymlink = st.isSymbolicLink(); + } catch (e) {} + + if (!isSymlink) { + copy('deps/npm', 'lib/node_modules/npm'); + queue.push('ln -sf ../lib/node_modules/npm/bin/npm-cli.js ' + + path.join(dest_dir, node_prefix, 'bin/npm')); + queue.push([shebang, '#!' + path.join(node_prefix, 'bin/node'), + path.join(dest_dir, node_prefix, + 'lib/node_modules/npm/bin/npm-cli.js')]); + } } } else { remove([ |