Skip to content

Conversation

@lovell
Copy link
Contributor

@lovell lovell commented Jul 4, 2020

Hello, modules that depend on node-addon-api cannot currently be installed into a parent directory containing whitespace.

To reproduce:

mkdir "/tmp/fail me"
cd "/tmp/fail me"
npm install --build-from-source --verbose sharp

...fails with:

g++: error: me/node_modules/node-addon-api: No such file or directory
make: *** [sharp.target.mk:139: Release/obj.target/sharp/src/common.o] Error 1
make: Leaving directory '/tmp/fail me/node_modules/sharp/build'

The change in this PR allows the use of parent paths that contain whitespace characters, plus keeps the approach consistent with that previously used and battle-tested by nan - see https://github.com/nodejs/nan/blob/master/include_dirs.js

Originally reported at lovell/sharp#2279

This allows the use of parent paths that contain whitespace, plus
keeps the approach consistent with that used by nan.

(The previous approach of adding double quotes did not work as
intended due to node-gyp removing these on the way through.)
Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM , seems reasonable to me.

@mhdawson
Copy link
Member

mhdawson commented Jul 7, 2020

@lovell is this something you've worked around or is it important to expedite a release with this change?

@lovell
Copy link
Contributor Author

lovell commented Jul 8, 2020

Thanks for the approval Michael.

Other than the avoidance of filesystem paths containing spaces, I'm not aware of any work around for this problem.

Copy link
Member

@NickNaso NickNaso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@mhdawson
Copy link
Member

mhdawson commented Jul 8, 2020

@NickNaso I think we should try to get a release out this week or next. Make sense to you ?

mhdawson pushed a commit that referenced this pull request Jul 8, 2020
Ensure include path is relative to process working directory (PWD)

This allows the use of parent paths that contain whitespace, plus
keeps the approach consistent with that used by nan.

(The previous approach of adding double quotes did not work as
intended due to node-gyp removing these on the way through.)

PR-URL: #757
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Nicola Del Gobbo <nicoladelgobbo@gmail.com>
@mhdawson
Copy link
Member

mhdawson commented Jul 8, 2020

Landed as 40c7926

@NickNaso
Copy link
Member

NickNaso commented Jul 8, 2020

@NickNaso I think we should try to get a release out this week or next. Make sense to you ?

@mhdawson Yes, I agree with you. I will prepare all in the weekend and if all will be good I will publish on Monday. Is it good for your?

@mhdawson
Copy link
Member

mhdawson commented Jul 8, 2020

@NickNaso sounds great, thanks for doing that !

@NickNaso
Copy link
Member

NickNaso commented Jul 9, 2020

@mhdawson This PR is open, but it's already landed, so I'm closing it.

@NickNaso NickNaso closed this Jul 9, 2020
@lovell lovell deleted the make-include-path-relative-to-pwd branch July 9, 2020 09:53
kevindavies8 added a commit to kevindavies8/node-addon-api-Develop that referenced this pull request Aug 24, 2022
Ensure include path is relative to process working directory (PWD)

This allows the use of parent paths that contain whitespace, plus
keeps the approach consistent with that used by nan.

(The previous approach of adding double quotes did not work as
intended due to node-gyp removing these on the way through.)

PR-URL: nodejs/node-addon-api#757
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Nicola Del Gobbo <nicoladelgobbo@gmail.com>
Marlyfleitas added a commit to Marlyfleitas/node-api-addon-Development that referenced this pull request Aug 26, 2022
Ensure include path is relative to process working directory (PWD)

This allows the use of parent paths that contain whitespace, plus
keeps the approach consistent with that used by nan.

(The previous approach of adding double quotes did not work as
intended due to node-gyp removing these on the way through.)

PR-URL: nodejs/node-addon-api#757
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Nicola Del Gobbo <nicoladelgobbo@gmail.com>
wroy7860 added a commit to wroy7860/addon-api-benchmark-node that referenced this pull request Sep 19, 2022
Ensure include path is relative to process working directory (PWD)

This allows the use of parent paths that contain whitespace, plus
keeps the approach consistent with that used by nan.

(The previous approach of adding double quotes did not work as
intended due to node-gyp removing these on the way through.)

PR-URL: nodejs/node-addon-api#757
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Nicola Del Gobbo <nicoladelgobbo@gmail.com>
johnfrench3 pushed a commit to johnfrench3/node-addon-api-git that referenced this pull request Aug 11, 2023
Ensure include path is relative to process working directory (PWD)

This allows the use of parent paths that contain whitespace, plus
keeps the approach consistent with that used by nan.

(The previous approach of adding double quotes did not work as
intended due to node-gyp removing these on the way through.)

PR-URL: nodejs/node-addon-api#757
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Nicola Del Gobbo <nicoladelgobbo@gmail.com>
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

Successfully merging this pull request may close these issues.

3 participants