Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Build failure when builddir contains spaces. #65

Open
jasondavies opened this Issue May 16, 2012 · 27 comments

Comments

Projects
None yet

See also: brianmcd/contextify#30.

For example, a home directory of Brad Old causes the build to fail:

> contextify@0.1.2 install /Users/Brad Old/Desktop/DEMO_jason/node_modules/d3/node_modules/jsdom/node_modules/contextify
> node-gyp rebuild

info it worked if it ends with ok 
info downloading: http://nodejs.org/dist/v0.6.17/node-v0.6.17.tar.gz 
spawn python [ '/Users/Brad Old/.node-gyp/0.6.17/tools/gyp_addon',
  'binding.gyp',
  '-I/Users/Brad Old/Desktop/DEMO_jason/node_modules/d3/node_modules/jsdom/node_modules/contextify/build/config.gypi',
  '-f',
  'make' ]
spawn make [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/contextify/src/contextify.o
clang: error: no such file or directory: 'Old/.node-gyp/0.6.17/src'
clang: error: no such file or directory: 'Old/.node-gyp/0.6.17/deps/uv/include'
clang: error: no such file or directory: 'Old/.node-gyp/0.6.17/deps/v8/include'
make: *** [Release/obj.target/contextify/src/contextify.o] Error 1
ERR! Error: `make` failed with exit code: 2
    at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
    at ChildProcess.emit (events.js:70:17)
    at maybeExit (child_process.js:362:16)
    at Process.onexit (child_process.js:398:5)
ERR! not ok
npm WARN optional dependency failed, continuing contextify@0.1.2

Notice the -I parameter is not escaped.

Collaborator

TooTallNate commented May 16, 2012

Confirmed. It looks like it might be a gyp bug, but I'll have to experiment a little bit more.

Collaborator

TooTallNate commented Jul 10, 2012

As a workaround, set your HOME env variable to something that doesn't contain spaces.

cshenoy commented Oct 15, 2012

Any updates to this issue?

trentm commented Nov 15, 2012

Added a pull that fixes at least the node-dtrace-provider (and hence the node-bunyan) issues mentioned here: TooTallNate#164

jmwohl commented Nov 12, 2013

This still seems to be an issue... any progress on it? Setting the HOME env var didn't seem to help, though I may not be doing that correctly.

@trentm trentm referenced this issue in chrisa/node-dtrace-provider Nov 14, 2013

Closed

Fails to build if there's a space in the directory tree #37

I still think this is an issue, @jmwohl.

Looking at the latest commit: https://github.com/TooTallNate/node-gyp/blob/7e98c99ce7e04e1599677a8b7919f7c387ad6a09/lib/configure.js#L311
And looking at the purposed solution: trentm/node-gyp@bbd979b

Looks like Pull Request was never merged: TooTallNate#164

Proposed Solution (lines 311+), from @trentm:

Old

argv.push('-Dnode_root_dir=' + nodeDir)
argv.push('-Dmodule_root_dir=' + process.cwd())

Fixed

Add:

function shellEscape(str) {
   return str.replace(/(["\s'$`\\])/g, '\\$1');
};

Change to:

argv.push('-Dnode_root_dir=' + shellEscape(nodeDir))
argv.push('-Dmodule_root_dir=' + shellEscape(process.cwd()))

Maybe I am missing something? My only confirmation that it is still not working is from the issue I made on another repository: nodegit/nodegit#123

Hope this can be resolved and merged soon!


Update:
Looks like the solution didn't completely work. Sorry for the false alarm 👎 .

@Glavin001 Glavin001 added a commit to Glavin001/node-gyp that referenced this issue Jan 6, 2014

@Glavin001 Glavin001 Update configure.js
Fixes #65. Build failure when builddir contains spaces.
Solution by @trentm.
See trentm@bbd979b
6bfb29b

sebnapi commented May 28, 2014

This is an Open Issue:

> fsevents@0.2.0 install /usr/local/lib/node_modules/karma/node_modules/chokidar/node_modules/fsevents
> node-gyp rebuild

make: *** No rule to make target `../../../../../../../../../../Volumes/Macintosh', needed by `Makefile'.  Stop.
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:807:12)
gyp ERR! System Darwin 13.2.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/karma/node_modules/chokidar/node_modules/fsevents
gyp ERR! node -v v0.10.28
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok 

workaround not working for me too

kfancy commented Aug 1, 2014

Work-around (definitely OS X, probably unix*) until this is fixed:

  1. create a new account, with no spaces in the folder name
  2. log in as that user
  3. install globally:

npm install -g PACKAGENAME

(this worked for me, to install zmq)

Bump I guess? This still is an issue afaik.

I am still having this issue here is a log output.

lwip@0.0.5 install /Users/michael dunton/projects/optimlol/node_modules/css-sprite/node_modules/lwip
> node-gyp rebuild

  CXX(target) Release/obj.target/lwip_decoder/src/decoder/init.o
clang: error: no such file or directory: 'dunton/.node-gyp/0.10.36/src'
clang: error: no such file or directory: 'dunton/.node-gyp/0.10.36/deps/uv/include'
clang: error: no such file or directory: 'dunton/.node-gyp/0.10.36/deps/v8/include'
make: *** [Release/obj.target/lwip_decoder/src/decoder/init.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Darwin 14.1.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/michael dunton/projects/optimlol/node_modules/css-sprite/node_modules/lwip
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok 

freder commented Mar 30, 2015

yep, still an issue:

clang: error: no such file or directory: 'HD'
clang: error: no such file or directory: '2/Projects/bla/code/bla.js/node_modules/libxslt/node_modules/libxmljs/src'
clang: error: no such file or directory: 'HD'
clang: error: no such file or directory: '2/Projects/bla/code/bla.js/node_modules/libxslt/node_modules/libxmljs/vendor/libxml/include'
make: *** [Release/obj.target/libexslt/deps/libxslt/libexslt/common.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1067:12)

@thomasjo thomasjo referenced this issue in electron/electron May 8, 2015

Closed

Build issues on Windows 8.1 #1623

Zae commented Jun 9, 2015

Any progress on this?

👍 Not just a Windows issue: I'm trying to install an Atom plug-in that uses node-gyp as a dependency, and my ~/.atom is stored on my cloud, by symlinking it to my "Google Drive" folder. I can't exactly rename that folder to not have a space, as it's tied into Google Drive's software...

Seems like this is a case for delimiting strings using a null character rather that splitting at spaces, kind of like find . -print0 | xargs -0 ... does, no?

Still an issue on Mac OS X 10.9.5.

kfancy commented Jul 15, 2015

It's probably going to remain an issue, my recommendation is to either
create a separate account to install global modules as necessary, or go
through the steps of removing the space from your user account directory
name, steps outlined in the link below.

https://support.apple.com/en-us/HT201548

On Wed, Jul 15, 2015 at 9:45 AM, David Rhoderick notifications@github.com
wrote:

Still an issue on Mac OS X 10.9.5.


Reply to this email directly or view it on GitHub
TooTallNate#65 (comment)
.

But why should it remain an issue, @kfancy? Plenty of CLI's support spaces in paths (and this is not just about the user root), this just seems like some missing escaping or quoting around a path parameter?

The global install works nicely, but it's a work-around.

kfancy commented Jul 15, 2015

I'm not saying that it shouldn't be fixed, but given the longevity of the
bug obviously it's not a priority...
so, either fix your spaces in your name path, or do global. :-)

On Wed, Jul 15, 2015 at 11:57 AM, Philip Blyth notifications@github.com
wrote:

But why should it remain an issue, @kfancy https://github.com/kfancy?
Plenty of CLI's support spaces in paths (and this is not just about the
user root), this just seems like some missing escaping or quoting around a
path parameter?

The global install works nicely, but it's a work-around.


Reply to this email directly or view it on GitHub
TooTallNate#65 (comment)
.

Good point... Hadn't noticed the 💀 date.

I ran into a similar problem under chrisa/node-dtrace-provider#65, and my failure mode looks a lot like the issue that https://codereview.chromium.org/287393002/ was intended to fix.

CrisLi commented Jul 26, 2015

I have the same issue when I install webpack

As a hack, you can create a SYMLINK for the target dir with no spaces. I tried at /Volumes/DIR_NAME_WITH_SPACES to /Volumes/DIR_WITH_NO_SPACES, then exported all ENV variables - HOME* for the newly defined value. This worked for me as my hard drive name contained spaces, changing from "Macintosh\ HD" to MacintoshHD via a symlink allowed webpack (node-gyp, fsevents,...) to install properly. YMMV

This is still an issue!

This seems like it should "simply" be a matter of finding an unquoted variable replacement in a shell command somewhere...... It's been an issue for 3 years now......

This is still an issue!

In the last 6 months I visited this issue twice.
So I documented the workaround that works for me.

My issue is that I have a hard-drive with the name Data HD.
And perhaps installing globally will work in most cases but not in mine.

To fix this: first create a symlink from your hard-drive-with-a-space-in-the-name

cd /Volumes/
ln -s 'Data HD' DataHD

The check your $HOME path:

echo $HOME
/Volumes/Data HD/Users/matthijs

Change $HOME (temporary?):

HOME=/Volumes/DataHD/Users/matthijs
export HOME
echo $HOME

Now use npm install and everything should work.

After you Quit the terminal, everything is set back to the original $HOME

Hope this saves someone time in the future

4lador commented May 15, 2016

Still an issue, even if it has a workaround it should be great if node-gyp could manage spaces in paths or send a warning about that :)

vedraan commented May 20, 2016

Yes, this is still a problem, hacking with SYMLINK doesn't seem like a good solution.

@salomvary salomvary added a commit to salomvary/node-gyp that referenced this issue Oct 18, 2016

@salomvary salomvary Fix escaping -I includes when path contains spaces
Fixes #65
ec6d3a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment