Skip to content

Fixes for building when the path to the repo contains spaces - #56401

Closed
Jayman2000 wants to merge 2 commits into
nodejs:mainfrom
Jayman2000:build-fixes-for-paths-with-spaces
Closed

Fixes for building when the path to the repo contains spaces#56401
Jayman2000 wants to merge 2 commits into
nodejs:mainfrom
Jayman2000:build-fixes-for-paths-with-spaces

Conversation

@Jayman2000

@Jayman2000 Jayman2000 commented Dec 29, 2024

Copy link
Copy Markdown

The “Building Node.js” guide says:

If the path to your build directory contains a space, the build will likely
fail.

This pull request contains a few fixes that are directed at that problem. I still haven’t been able to successfully build and test Node.js while it’s stored in a path that contains spaces, but the changes in this pull request have gotten me closer to being able to do that.

Unfortunately, in order to test one of the commits in this pull request, a vendored dependency of a vendored dependency of a vendored dependency needs to be patched. I’m going to mark this pull request as a draft until the following has happened:

  • I have submitted a nodejs/gyp-next pull request with the required changes.
  • That pull request gets merged.
  • There’s a new release of nodejs/gyp-next that contains the changes from that pull request.
  • Someone submits a nodejs/node-gyp pull request that updates nodejs/node-gyp’s version of nodejs/gyp-next.
  • That pull request gets merged.
  • There’s a new release of nodejs/node-gyp that contains the new version of nodejs/gyp-next.
  • Someone submits an npm/cli pull request that updates npm/cli’s version of nodejs/node-gyp.
  • That pull request gets merged.
  • There’s a new release of npm/cli that contains the new version of nodejs/node-gyp.
  • Someone submits a nodejs/node pull request that updates nodejs/node’s version of npm/cli.
  • That pull request gets merged.
  • I rebase this current pull request on nodejs/node’s main branch.
  • I add testing instructions to this current pull request.

Before this change, Makefile would sometimes use quotation marks when
expanding the NODE Make variable and sometimes would not use quotation
marks when expanding the NODE Make variable. This change makes it so
that the Makefile never uses quotation marks when expanding the NODE
variable.

Line 82 of the Makefile sets the NODE variable to this:

  NODE ?= "$(PWD)/$(NODE_EXE)"

Since there are already quotation marks embedded in the value of the
NODE variable, we don’t need to add additional quotes when expanding the
variable. In fact, adding quotes can cause issues. For example, before
this change, line 97 of the Makefile said this:

         if [ -x "$(NODE)" ] && [ -e "$(NODE)" ]; then \

If you tried to run “make test-only” and the path your copy of the
Node.js source code contained spaces, then that line would expand to
something like this:

         if [ -x ""/Path that contains spaces/node"" ] && [ -e ""/Path that contains spaces/node"" ]; then \

The shell would then fail to run that command because of the improper
quoting.
The Makefile contains two variable: NODE and run-npm-ci. Here’s the line
that sets the NODE variable:

  NODE ?= "$(PWD)/$(NODE_EXE)"

The value of the NODE variable contains quotation marks just in case
$(PWD) contains spaces. Before this change, here’s how the run-npm-ci
variable was set:

  run-npm-ci = $(PWD)/$(NPM) ci

The value of the run-npm-ci variable does not contain quotation marks.
$(run-npm-ci) is supposed expand into two words when interpreted by a
shell, but if $(PWD) contained spaces, then it would expand into more
than 2 words.

This change adds quotation marks to the value of run-npm-ci. This change
makes the Makefile more consistent and helps make sure that
$(run-npm-ci) does the right thing, even if $(PWD) contains spaces.
@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. needs-ci PRs that need a full CI run. labels Dec 29, 2024
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

@github-actions github-actions Bot added the stale label Jul 28, 2026
@Jayman2000

Copy link
Copy Markdown
Author

Now that #60511 has been merged, this pull request is obsolete.

@Jayman2000 Jayman2000 closed this Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Issues and PRs related to build files or the CI. needs-ci PRs that need a full CI run. stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants