node-gyp: Build failure when builddir contains spaces.
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.
About this issue
- Original URL
- State: closed
- Created 12 years ago
- Reactions: 10
- Comments: 48 (9 by maintainers)
Commits related to this issue
- issue #65: fix some shell escaping for building in a dir with spaces — committed to trentm/node-gyp by trentm 12 years ago
- Update configure.js Fixes #65. Build failure when builddir contains spaces. Solution by @trentm. See https://github.com/trentm/node-gyp/commit/bbd979bca2af5dfe29169ac50db17372fb4971b3 — committed to Glavin001/node-gyp by Glavin001 10 years ago
- Fix escaping -I includes when path contains spaces Fixes #65 — committed to salomvary/node-gyp by salomvary 8 years ago
- win: auto-include marmasm sections for Windows on ARM (#65) This removes the msvs_enable_marmasm configuration option that becomes unnecessary. Closes: https://github.com/nodejs/gyp-next/issues/6... — committed to targos/node-gyp by targos 4 years ago
- fix: failure when build directory contains spaces (#65) — committed to davej/node-gyp by davej 3 years ago
- fix: failure when build directory contains spaces Fix an installation issue that occurs when a path in which node-gyp is run contains spaces. For a path like `my app`, it would error with this messa... — committed to tombruijn/gyp-next by davej 3 years ago
- fix: failure when build directory contains spaces Fix an installation issue that occurs when a path in which node-gyp is run contains spaces. For a path like `my app`, it would error with this messa... — committed to tombruijn/gyp-next by davej 3 years ago
^ Rude.
Closing. It’s been discussed in other issues and it’s not going to change; gyp itself doesn’t support blanks in paths.
Yes, this is still a problem, hacking with SYMLINK doesn’t seem like a good solution.
If you are using MacOS and your username contains space, such as:
/Users/abc 1
, I fix with:HOME
env to installAs a workaround, set your
HOME
env variable to something that doesn’t contain spaces.It looks so easy to fix.
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
The check your $HOME path:
Change $HOME (temporary?):
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
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…
👍 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?Bump I guess? This still is an issue afaik.
Can we have a GitHub Action that fails which demonstrates this problem? Which pull request should be reviewed?
The rabbit hole goes even deeper because not all tools that gyp calls out to handle them either.
Still an issue on Mac OS X 10.9.5.
Any progress on this?
yep, still an issue:
This is an Open Issue:
workaround not working for me too