Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure when builddir contains spaces. #65

Closed
jasondavies opened this issue May 16, 2012 · 36 comments · May be fixed by #1038
Closed

Build failure when builddir contains spaces. #65

jasondavies opened this issue May 16, 2012 · 36 comments · May be fixed by #1038

Comments

@jasondavies
Copy link

@jasondavies jasondavies commented May 16, 2012

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.

@TooTallNate
Copy link
Contributor

@TooTallNate 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.

@TooTallNate
Copy link
Contributor

@TooTallNate TooTallNate commented Jul 10, 2012

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

@cshenoy
Copy link

@cshenoy cshenoy commented Oct 15, 2012

Any updates to this issue?

@trentm
Copy link

@trentm trentm commented Nov 15, 2012

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

@jmwohl
Copy link

@jmwohl 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.

@Glavin001
Copy link

@Glavin001 Glavin001 commented Jan 6, 2014

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@bbd979b

Looks like Pull Request was never merged: #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 👎 .

@sebnapi
Copy link

@sebnapi 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
Copy link

@kfancy 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)

@carstenhag
Copy link

@carstenhag carstenhag commented Jan 23, 2015

Bump I guess? This still is an issue afaik.

@Mike-Dunton
Copy link

@Mike-Dunton Mike-Dunton commented Feb 3, 2015

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
Copy link

@freder 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)
@Zae
Copy link

@Zae Zae commented Jun 9, 2015

Any progress on this?

@nemoDreamer
Copy link

@nemoDreamer nemoDreamer commented Jun 29, 2015

👍 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?

@davidrhoderick
Copy link

@davidrhoderick davidrhoderick commented Jul 15, 2015

Still an issue on Mac OS X 10.9.5.

@kfancy
Copy link

@kfancy 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
#65 (comment)
.

@ni-vo
Copy link

@ni-vo ni-vo commented Feb 27, 2018

Bumping

@bnoordhuis
Copy link
Member

@bnoordhuis bnoordhuis commented Feb 27, 2018

^ Rude.

Closing. It's been discussed in other issues and it's not going to change; gyp itself doesn't support blanks in paths.

@bnoordhuis bnoordhuis closed this Feb 27, 2018
@gibfahn
Copy link
Member

@gibfahn gibfahn commented Feb 27, 2018

it's not going to change; gyp itself doesn't support blanks in paths.

If someone would like to patch gyp to handle spaces in paths that would be fine, but raising issues in node-gyp isn't helpful.

@bnoordhuis
Copy link
Member

@bnoordhuis bnoordhuis commented Feb 27, 2018

The rabbit hole goes even deeper because not all tools that gyp calls out to handle them either.

@03sarath
Copy link

@03sarath 03sarath commented Mar 25, 2020

/ Building module: bindings, Completed: 0Attempting to build a module with a space in the path
See https://github.com/nodejs/node-gyp/issues/65#issuecomment-368820565 for reasons why this may not work
× Rebuild Failed

An unhandled error occurred inside electron-rebuild
'F:\Psitron' is not recognized as an internal or external command,
operable program or batch file.
'D' is not recognized as an internal or external command,
operable program or batch file.

Failed with exit code: 1

Error: 'F:\Psitron' is not recognized as an internal or external command,
operable program or batch file.
'D' is not recognized as an internal or external command,
operable program or batch file.

Failed with exit code: 1
    at SafeSubscriber._error (F:\Psitron Technologies\CONF DOC\R&D LoRa\BOM\Software\COM\electron-quick-start\node_modul
es\spawn-rx\lib\src\index.js:267:84)
    at SafeSubscriber.__tryOrUnsub (F:\Psitron Technologies\CONF DOC\R&D LoRa\BOM\Software\COM\electron-quick-start\node
_modules\rxjs\internal\Subscriber.js:205:16)
    at SafeSubscriber.error (F:\Psitron Technologies\CONF DOC\R&D LoRa\BOM\Software\COM\electron-quick-start\node_module
s\rxjs\internal\Subscriber.js:156:26)
    at Subscriber._error (F:\Psitron Technologies\CONF DOC\R&D LoRa\BOM\Software\COM\electron-quick-start\node_modules\r
xjs\internal\Subscriber.js:92:26)
    at Subscriber.error (F:\Psitron Technologies\CONF DOC\R&D LoRa\BOM\Software\COM\electron-quick-start\node_modules\rx
js\internal\Subscriber.js:72:18)
    at MapSubscriber.Subscriber._error (F:\Psitron Technologies\CONF DOC\R&D LoRa\BOM\Software\COM\electron-quick-start\
node_modules\rxjs\internal\Subscriber.js:92:26)
    at MapSubscriber.Subscriber.error (F:\Psitron Technologies\CONF DOC\R&D LoRa\BOM\Software\COM\electron-quick-start\n
ode_modules\rxjs\internal\Subscriber.js:72:18)
    at SafeSubscriber._next (F:\Psitron Technologies\CONF DOC\R&D LoRa\BOM\Software\COM\electron-quick-start\node_module
s\spawn-rx\lib\src\index.js:242:65)
    at SafeSubscriber.__tryOrUnsub (F:\Psitron Technologies\CONF DOC\R&D LoRa\BOM\Software\COM\electron-quick-start\node
_modules\rxjs\internal\Subscriber.js:205:16)
    at SafeSubscriber.next (F:\Psitron Technologies\CONF DOC\R&D LoRa\BOM\Software\COM\electron-quick-start\node_modules
\rxjs\internal\Subscriber.js:143:22)

_Hey guys,

I hope you all doing good, Thanks in advance. Really I tried 100 way to get rid of these errors. I couldn't.I need your advice._

@cclauss
Copy link
Contributor

@cclauss cclauss commented Mar 25, 2020

F:\Psitron Technologies\CONF DOC\R&D LoRa —>
F:\Psitron_Technologies\CONF_DOC\R&D_LoRa ?

@iammapping
Copy link

@iammapping iammapping commented May 25, 2020

If you are using MacOS and your username contains space, such as: /Users/abc 1, I fix with:

  1. Create a link file without space
sudo ln -s /Users/abc\ 1 /Users/abc
  1. specify HOME env to install
HOME=/Users/abc npm install
@ihatzi
Copy link

@ihatzi ihatzi commented May 27, 2020

How can I fix this on a PC running Windows 10?

@vishalmakebot
Copy link

@vishalmakebot vishalmakebot commented Feb 19, 2021

× Rebuild Failed

An unhandled error occurred inside electron-rebuild
'C:\Users\Awaghade' is not recognized as an internal or external command,
operable program or batch file.

Failed with exit code: 1

Error: 'C:\Users\Awaghade' is not recognized as an internal or external command,
operable program or batch file.

Failed with exit code: 1
at SafeSubscriber._error (C:\Users\Awaghade Family\Downloads\mBlock-master (1)\mBlock-master\node_modules\spawn-rx\lib\src\index.js:267:84)
at SafeSubscriber.__tryOrUnsub (C:\Users\Awaghade Family\Downloads\mBlock-master (1)\mBlock-master\node_modules\rxjs\internal\Subscriber.js:205:16)
at SafeSubscriber.error (C:\Users\Awaghade Family\Downloads\mBlock-master (1)\mBlock-master\node_modules\rxjs\internal\Subscriber.js:156:26)
at Subscriber._error (C:\Users\Awaghade Family\Downloads\mBlock-master (1)\mBlock-master\node_modules\rxjs\internal\Subscriber.js:92:26)
at Subscriber.error (C:\Users\Awaghade Family\Downloads\mBlock-master (1)\mBlock-master\node_modules\rxjs\internal\Subscriber.js:72:18)
at MapSubscriber.Subscriber._error (C:\Users\Awaghade Family\Downloads\mBlock-master (1)\mBlock-master\node_modules\rxjs\internal\Subscriber.js:92:26)
at MapSubscriber.Subscriber.error (C:\Users\Awaghade Family\Downloads\mBlock-master (1)\mBlock-master\node_modules\rxjs\internal\Subscriber.js:72:18)
at SafeSubscriber._next (C:\Users\Awaghade Family\Downloads\mBlock-master (1)\mBlock-master\node_modules\spawn-rx\lib\src\index.js:242:65)
at SafeSubscriber.__tryOrUnsub (C:\Users\Awaghade Family\Downloads\mBlock-master (1)\mBlock-master\node_modules\rxjs\internal\Subscriber.js:205:16)
at SafeSubscriber.next (C:\Users\Awaghade Family\Downloads\mBlock-master (1)\mBlock-master\node_modules\rxjs\internal\Subscriber.js:143:22)
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! mBlock@4.0.0 rebuild-serialport: electron-rebuild -f -w serialport
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the mBlock@4.0.0 rebuild-serialport script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Awaghade Family\AppData\Roaming\npm-cache_logs\2021-02-19T05_43_17_172Z-debug.log

i have the same issue . can anyone please help me out. i am using windows 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.