Skip to content

Cannot load externalized builtin: "internal/deps/cjs-module-lexer/lexer:/usr/lib/node_modules/cjs-module-lexer/lexer.js". #92

Open

Description

@aswinbennyofficial

I am getting this error whenever I try to install something from npm

Error

>sudo npm install -g @angular/cli
Cannot load externalized builtin: "internal/deps/cjs-module-lexer/lexer:/usr/lib/node_modules/cjs-module-lexer/lexer.js".
----- Native stack trace -----

 1: 0x7f32e98f472e node::builtins::BuiltinLoader::AddExternalizedBuiltin(char const*, char const*) [/lib64/libnode.so.115]
 2: 0x7f32e98f4935 node::builtins::BuiltinLoader::BuiltinLoader() [/lib64/libnode.so.115]
 3: 0x7f32e98418d7 node::InitializePrimordials(v8::Local<v8::Context>) [/lib64/libnode.so.115]
 4: 0x7f32e9841a08 node::GetPerContextExports(v8::Local<v8::Context>) [/lib64/libnode.so.115]
 5: 0x7f32e98417e8 node::InitializePrimordials(v8::Local<v8::Context>) [/lib64/libnode.so.115]
 6: 0x7f32e9841ae0 node::InitializeMainContextForSnapshot(v8::Local<v8::Context>) [/lib64/libnode.so.115]
 7: 0x7f32e9841b05 node::InitializeContext(v8::Local<v8::Context>) [/lib64/libnode.so.115]
 8: 0x7f32e9841b63 node::NewContext(v8::Isolate*, v8::Local<v8::ObjectTemplate>) [/lib64/libnode.so.115]
 9: 0x7f32e997c9b4 node::NodeMainInstance::CreateMainEnvironment(node::ExitCode*) [/lib64/libnode.so.115]
10: 0x7f32e997cb0d node::NodeMainInstance::Run() [/lib64/libnode.so.115]
11: 0x7f32e98df351 node::Start(int, char**) [/lib64/libnode.so.115]
12: 0x7f32e8c4614a  [/lib64/libc.so.6]
13: 0x7f32e8c4620b __libc_start_main [/lib64/libc.so.6]
14: 0x55f96f486035 _start [node]
Aborted

File versions

  • These are the files I downloaded
Installing:
 nodejs                               x86_64              1:20.12.0-1.fc39                         updates               50 k
Installing dependencies:
 nodejs-cjs-module-lexer              noarch              1.2.3-2.fc39                             updates               37 k
 nodejs-libs                          x86_64              1:20.12.0-1.fc39                         updates               15 M
 nodejs-undici                        noarch              6.11.1-2.fc39                            updates              290 k
Installing weak dependencies:
 nodejs-docs                          noarch              1:20.12.0-1.fc39                         updates              8.2 M
 nodejs-full-i18n                     x86_64              1:20.12.0-1.fc39                         updates              8.4 M
 nodejs-npm                           x86_64              1:10.5.0-1.20.12.0.1.fc39                updates              2.2 M

Things I tried:

  • On reinstall it works, but same error after installing any package
  • Tried restarting
  • Tried logout

System Details Report


Report details

  • Date generated: 2024-04-15 10:11:23

Hardware Information:

  • Hardware Model: HP HP Notebook
  • Memory: 8.0 GiB
  • Processor: Intel® Core™ i3-5005U × 4
  • Graphics: Intel® HD Graphics 5500 (BDW GT2)
  • Graphics 1: HAINAN
  • Disk Capacity: 1.2 TB

Software Information:

  • Firmware Version: F.47
  • OS Name: Fedora Linux 39 (Workstation Edition)
  • OS Build: (null)
  • OS Type: 64-bit
  • GNOME Version: 45.5
  • Windowing System: Wayland
  • Kernel Version: Linux 6.8.4-200.fc39.x86_64

Activity

  1. guybedford commented on Apr 19, 2024

    @guybedford
    Collaborator

    //cc @mochaaP this seems like it may be related to your recent work. Will the release of #91 help here?

  2. mochaaP commented on Apr 19, 2024

    @mochaaP
    Contributor

    We haven't cooperated that change in any released versions yet, both in nodejs20 and nodejs-cjs-module-lexer. Also, this seems to be a distro-specific issue, so please raise it in https://bugzilla.redhat.com/

    Besides, I could not reproduce this on f39 with the following packages:

    nodejs-docs-1:20.12.0-1.fc39.noarch
    libuv-1:1.48.0-1.fc39.x86_64
    nodejs-libs-1:20.12.0-1.fc39.x86_64nodejs-undici-6.11.1-2.fc39.noarch
    nodejs-cjs-module-lexer-1.2.3-2.fc39.noarch
    nodejs-full-i18n-1:20.12.0-1.fc39.x86_64
    nodejs-npm-1:10.5.0-1.20.12.0.1.fc39.x86_64
    nodejs-1:20.12.0-1.fc39.x86_64 
    

    Does your root filesystem support symlinks? /usr/lib/node_modules should be a symlink to node_modules_20 on Fedora 39+ and RHEL 10+.

  3. mochaaP commented on Apr 19, 2024

    @mochaaP
    Contributor

    Oh, I recalled what's the issue here. libuv made io_uring default from a while ago, and it got merged into Node.js. Unfortunately, the implementation (kernel? libuv?) is currently buggy and had various quirks when doing file I/Os. A workaround is to set UV_USE_IO_URING=0 in your environment variables.

  4. mochaaP commented on Apr 19, 2024

    @mochaaP
    Contributor

    Seemed to be a kernel regression. Tested with a clean f39 podman container on 6.9.0-0.rc4.37.fc41.x86_64, works well. @aswinbennyofficial Could you test it on Fedora 40?

  5. aswinbennyofficial commented on Apr 20, 2024

    @aswinbennyofficial
    Author

    @mochaaP I havent installed fedora 40 yet.

    I have created a bug report on bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=2276166

  6. mochaaP commented on Apr 20, 2024

    @mochaaP
    Contributor

    @guybedford since this isn't a cjs-module-lexer issue but a kernel/libuv/node one, we can close this here.

  7. aswinbennyofficial commented on Apr 20, 2024

    @aswinbennyofficial
    Author

    Oh, I recalled what's the issue here. libuv made io_uring default from a while ago, and it got merged into Node.js. Unfortunately, the implementation (kernel? libuv?) is currently buggy and had various quirks when doing file I/Os. A workaround is to set UV_USE_IO_URING=0 in your environment variables

    I tried this still was having the same error

    image

    image

  8. mochaaP commented on Apr 20, 2024

    @mochaaP
    Contributor

    Forwarding from rhbz.


    OK, I figured this out.

    You are running npm as root and your npmrc sets prefix=/usr, which overrides /usr/lib/> node_modules to a folder instead of a symlink.
    Please don't install npm packages globally, at least not installing to /usr/lib.

  9. mochaaP commented on Apr 20, 2024

    @mochaaP
    Contributor

    /tag invalid
    /close

  10. mdx0111 commented on Sep 17, 2024

    @mdx0111

    I can confirm that this is happening with Fedora 40 as well.

  11. rhass commented on Dec 13, 2024

    @rhass

    Also present in Fedora 41.

    Steps to reproduce:

    docker run --rm -it fedora:41
    dnf install -y nodejs18 nodejs18-npm
    npm-18 --version
    Cannot load externalized builtin: "internal/deps/cjs-module-lexer/lexer:/usr/lib/node_modules/cjs-module-lexer/lexer.js".
     1: 0x7b39a1be954c node::Abort() [/lib64/libnode.so.108]
     2: 0x7b39a1bddb76  [/lib64/libnode.so.108]
     3: 0x7b39a1bddcfc node::builtins::BuiltinLoader::BuiltinLoader() [/lib64/libnode.so.108]
     4: 0x7b39a1b3e274 node::InitializePrimordials(v8::Local<v8::Context>) [/lib64/libnode.so.108]
     5: 0x7b39a1b3e3a8 node::GetPerContextExports(v8::Local<v8::Context>) [/lib64/libnode.so.108]
     6: 0x7b39a1b3e198 node::InitializePrimordials(v8::Local<v8::Context>) [/lib64/libnode.so.108]
     7: 0x7b39a1b3e480 node::InitializeMainContextForSnapshot(v8::Local<v8::Context>) [/lib64/libnode.so.108]
     8: 0x7b39a1b3e4a5 node::InitializeContext(v8::Local<v8::Context>) [/lib64/libnode.so.108]
     9: 0x7b39a1b3e503 node::NewContext(v8::Isolate*, v8::Local<v8::ObjectTemplate>) [/lib64/libnode.so.108]
    10: 0x7b39a1c49a24 node::NodeMainInstance::CreateMainEnvironment(int*) [/lib64/libnode.so.108]
    11: 0x7b39a1c49bab node::NodeMainInstance::Run() [/lib64/libnode.so.108]
    12: 0x7b39a1bbd1a3 node::LoadSnapshotDataAndRun(node::SnapshotData const**, node::InitializationResult const*) [/lib64/libnode.so.108]
    13: 0x7b39a1bbd649 node::Start(int, char**) [/lib64/libnode.so.108]
    14: 0x7b39a10cf248  [/lib64/libc.so.6]
    15: 0x7b39a10cf30b __libc_start_main [/lib64/libc.so.6]
    16: 0x60d4ed16e035 _start [/usr/bin/node-18]
    Aborted (core dumped)

    Edit:

    As mentioned by mochaaP; I think this is an issue in the underlying OS implementation/packaging.

  12. mochaaP commented on Dec 14, 2024

    @mochaaP
    Contributor

    This is because the symlink /usr/lib/node_modules -> /usr/lib/node_modules_<default_major_version> is provided by package nodejs. Please report this at rhbz so we could track it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions