From 70392aec79ebf012a24b9c0a30855df7757af1f3 Mon Sep 17 00:00:00 2001 From: Slava Kim Date: Thu, 11 Dec 2014 17:26:23 -0800 Subject: [PATCH] Don't symlink node_modules on Windows because symlinking is hard --- tools/builder.js | 8 +++++++- tools/bundler.js | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/builder.js b/tools/builder.js index b62eb44de5..55f5d3968a 100644 --- a/tools/builder.js +++ b/tools/builder.js @@ -323,10 +323,16 @@ _.extend(Builder.prototype, { throw new Error("can't copy only specific paths with a single symlink"); } - var canSymlink = true; if (self.usedAsFile[normOptionsTo]) { throw new Error("tried to copy a directory onto " + normOptionsTo + " but it is is already a file"); + } + + var canSymlink = true; + // Symlinks don't work exactly the same way on Windows, and furthermore + // they request Admin permissions to set. + if (process.platform === 'win32') { + canSymlink = false; } else if (normOptionsTo in self.usedAsFile) { // It's already here and is a directory, maybe because of a call to // reserve with {directory: true}. If it's an empty directory, this is diff --git a/tools/bundler.js b/tools/bundler.js index 38afca0f9b..ead6c81776 100644 --- a/tools/bundler.js +++ b/tools/bundler.js @@ -1682,8 +1682,9 @@ _.extend(ServerTarget.prototype, { // install' using the above package.json and npm-shrinkwrap.json on every // rebuild). if (options.includeNodeModulesSymlink) { - builder.write('node_modules', { - symlink: files.pathJoin(files.getDevBundle(), 'server-lib', 'node_modules') + builder.copyDirectory({ + from: files.pathJoin(files.getDevBundle(), 'lib', 'node_modules'), + to: 'node_modules' }); }