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 fails with spaces in path #409

Closed
codeplea opened this issue Aug 7, 2018 · 2 comments
Closed

Build fails with spaces in path #409

codeplea opened this issue Aug 7, 2018 · 2 comments

Comments

@codeplea
Copy link
Contributor

codeplea commented Aug 7, 2018

If I download the example addon and run npm install on Ubuntu, it works. But if I copy it into a directory with a space in its name, then it breaks:

guest-hx3jkc@ubby16:~/Desktop/with spaces$ npm install

> [email protected] install /tmp/guest-hx3jkc/Desktop/with spaces
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://node-pre-gyp-tests.s3-us-west-1.amazonaws.com/node_addon_example/v0.1.5/Release/node_addon_example-v0.1.5-node-v57-linux-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v57 ABI, glibc) (falling back to source compile with node-gyp) 
make: Entering directory '/tmp/guest-hx3jkc/Desktop/with spaces/build'
  CXX(target) Release/obj.target/node_addon_example/binding.o
  SOLINK_MODULE(target) /tmp/guest-hx3jkc/Desktop/with spaces/lib/binding/Release/node-v57-linux-x64/node_addon_example.node
g++: error: node_addon_example.node: No such file or directory
g++: error: spaces/lib/binding/Release/node-v57-linux-x64/node_addon_example.node: No such file or directory
node_addon_example.target.mk:123: recipe for target '/tmp/guest-hx3jkc/Desktop/with spaces/lib/binding/Release/node-v57-linux-x64/node_addon_example.node' failed
make: *** [/tmp/guest-hx3jkc/Desktop/with spaces/lib/binding/Release/node-v57-linux-x64/node_addon_example.node] Error 1
make: Leaving directory '/tmp/guest-hx3jkc/Desktop/with spaces/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.8.0-36-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/tmp/guest-hx3jkc/Desktop/with spaces/lib/binding/Release/node-v57-linux-x64/node_addon_example.node" "--module_name=node_addon_example" "--module_path=/tmp/guest-hx3jkc/Desktop/with spaces/lib/binding/Release/node-v57-linux-x64"
gyp ERR! cwd /tmp/guest-hx3jkc/Desktop/with spaces
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/tmp/guest-hx3jkc/Desktop/with spaces/lib/binding/Release/node-v57-linux-x64/node_addon_example.node --module_name=node_addon_example --module_path=/tmp/guest-hx3jkc/Desktop/with spaces/lib/binding/Release/node-v57-linux-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/tmp/guest-hx3jkc/Desktop/with spaces/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 4.8.0-36-generic
node-pre-gyp ERR! command "/usr/bin/node" "/tmp/guest-hx3jkc/Desktop/with spaces/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /tmp/guest-hx3jkc/Desktop/with spaces
node-pre-gyp ERR! node -v v8.11.3
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok 
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/tmp/guest-hx3jkc/Desktop/with spaces/lib/binding/Release/node-v57-linux-x64/node_addon_example.node --module_name=node_addon_example --module_path=/tmp/guest-hx3jkc/Desktop/with spaces/lib/binding/Release/node-v57-linux-x64' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install 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!     /tmp/guest-hx3jkc/.npm/_logs/2018-08-07T20_40_38_575Z-debug.log
guest-hx3jkc@ubby16:~/Desktop/with spaces$ 

It seems the relevant part is:

SOLINK_MODULE(target) /tmp/guest-hx3jkc/Desktop/with spaces/lib/binding/Release/node-v57-linux-x64/node_addon_example.node
g++: error: node_addon_example.node: No such file or directory
g++: error: spaces/lib/binding/Release/node-v57-linux-x64/node_addon_example.node: No such file or directory

You can see that the filename got split at the space in the path. I'm assuming that the path is not being properly escaped in the Makefile.

This is affecting my project, Tulip Node, but I used the node-pre-gyp example addon for testing as I assume that will be easier to debug.

Any help will be greatly appreciated. Thanks!

@georgezouq
Copy link

Same error, How to fix this?

@springmeyer
Copy link
Contributor

I think this is a problem not in node-pre-gyp but the underlying build tools: nodejs/node-gyp#65. Please re-open if you disagree. I don't know of a workaround other than avoiding spaces.

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

No branches or pull requests

3 participants