Skip to content

node built with --node-builtin-modules-path not working #5077

@anilhelvaci

Description

@anilhelvaci

Node.js Version

v25.0.0-pre

NPM Version

Operating System

RHEL 8

Subsystem

Other

Description

I'm trying to work on part of nodejs that's only related to lib directory. So I build my binary using:

./configure --ninja --node-builtin-modules-path /usr/node

The build works fine, but the resulting binary doesn't work.

My Environment

I'm running registry.access.redhat.com/ubi8:latest image on arm64 architecture. Here are the dependencies I used to build node. For reference:

dnf install --disableplugin=subscription-manager -y \
      https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \
    && dnf update --disableplugin=subscription-manager -y \
    && dnf install --disableplugin=subscription-manager -y \
      ccache \
      gcc-c++ \
      gcc-toolset-12 \
      git \
      glibc-devel.i686 \
      java-17-openjdk-headless \
      libatomic.i686 \
      libstdc++-devel \
      libstdc++-devel.i686 \
      make \
      python3.12 \
      python3.12-setuptools \
      procps-ng \
      xz 

My machine is Apple Macbook M1 Pro.

One Weird Thing

If I run any test using tools/test.py it works! I believe this is somehow related to the environment tools/test.py creates. However I've tried with the same env variables and arguments and didn't have luck.

To Reproduce

Minimal Reproduction

  • docker run -it --platform linux/arm64 -w /usr/node registry.access.redhat.com/ubi8:latest /bin/bash
  • Install dependencies like above
  • git clone https://github.com/anilhelvaci/node.git
  • cd node
  • ./configure --ninja --node-builtin-modules-path /usr/node
  • ./node --help

tools/test.py

  • cd node
  • tools/test.py -v test/parallel/test-http-client-race.js

Output

[root@d585bc993bf9 node]# ./node
node:internal/bootstrap/switches/is_main_thread:56
      stream = new tty.WriteStream(fd);
               ^

TypeError: tty.WriteStream is not a constructor
    at createWritableStdioStream (node:internal/bootstrap/switches/is_main_thread:56:16)
    at process.getStdout [as stdout] (node:internal/bootstrap/switches/is_main_thread:153:12)
    at console.get (node:internal/console/constructor:211:38)
    at console.value (node:internal/console/constructor:334:50)
    at console.log (node:internal/console/constructor:384:61)
    at node:net:42:9
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:398:7)
    at requireBuiltin (node:internal/bootstrap/realm:429:14)
    at node:tty:29:13
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:398:7)

Node.js v25.0.0-pre

tools/test.py

[root@d585bc993bf9 node]# tools/test.py -v test/parallel/test-http-client-race.js 
MY_CONTEXT ['--test-reporter=./test/common/test-error-reporter.js', '--test-reporter-destination=stdout']
MY_ARGS ['out/Release/node', '-p', 'process.arch']
# out/Release/node -p process.arch
MY_ARGS ['out/Release/node', '-p', 'process.versions.openssl']
# out/Release/node -p process.versions.openssl
MY_ARGS ['out/Release/node', '-p', 'process.config.variables.asan']
# out/Release/node -p process.config.variables.asan
MY_ARGS ['out/Release/node', '-p', 'process.config.variables.v8_enable_pointer_compression']
# out/Release/node -p process.config.variables.v8_enable_pointer_compression
MY_ARGS ['out/Release/node', '-p', 'process.features.inspector']
# out/Release/node -p process.features.inspector
MY_ARGS ['out/Release/node', '-p', 'process.versions.openssl']
# out/Release/node -p process.versions.openssl
[00:00|%   0|+   0|-   0]: release test-http-client-raceMY_ARGS ['out/Release/node', '--test-reporter=./test/common/test-error-reporter.js', '--test-reporter-destination=stdout', '/usr/node/test/parallel/test-http-client-race.js']
# out/Release/node --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout /usr/node/test/parallel/test-http-client-race.js
[00:00|% 100|+   1|-   0]: Done                         

All tests passed.

Don't mind MY_ARGS. Just a print statement I've inserted to look up what's going on.

Before You Submit

  • I have looked for issues that already exist before submitting this
  • My issue follows the guidelines in the README file, and follows the 'How to ask a good question' guide at https://stackoverflow.com/help/how-to-ask

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions