ICU symbol not found with node and bun

Hi folks, I am trying to build a react native project and I am using bun as the package manager, but I am getting the following error message:

  📦 Installing [1662/1951] dyld[46253]: Symbol not found: __ZNK6icu_746number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
  Referenced from: <2012A65E-5EB9-311D-80C8-99FD31D3890D> /nix/store/9vkabbbbyfn8hv5l1r8fm59d27imq460-nodejs-22.11.0/bin/node
  Expected in:     <59FD1226-789A-3063-B6B6-2E92BEEA57E8> /nix/store/3v1icdy3q210szf1ccwvxngskixn2p0d-ICU-74221/lib/libicui18n.74.2.dylib

error: postinstall script from "esbuild" terminated by SIGABRT (Abort)
[1]    46249 abort      bun install

Setup:

  • MacOS Sequoia Version 15.2 (24C101)
  • I have the following packages installed:
    • bun
    • nodejs_22

Here’s a simple package.json that can help reproduce the error:

{
  "name": "bun-demo",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "esbuild": "0.24.2"
  },
  "trustedDependencies": [
    "esbuild"
  ]
}

bun install should give you the error.

I tried this on a CentOS 9 box and things work fine so I guess it is a MacOS specific issue.

I have tried various things like trying to include icu76 by following this and this, but it is still using a different icu.

This also seems to be related to bun: fix darwin build and runtime issues by sandydoo · Pull Request #358195 · NixOS/nixpkgs · GitHub. It is forcing nix to use darwin.ICU which is at version 74221.

I am very new to all this and I tried a few different approaches and had no luck. Any tips would be appreciated.

This should be fixed on staging-next. Darwin’s ICU is being made the default.

The problem is upstream icu includes the version number in symbol names while Darwin’s ICU does not. Once Node.js is rebuilt with the unversioned symbols, this error should go away.

1 Like

Hi @reckenrode, thanks for the reply!

I apologize for the delay in responding, I missed the email notification.

I am using packages from nixos-unstable, and my understanding is that they should now include the fix you mentioned.

I’m still encountering this issue even with the updated packages. Are there any debugging steps or checks you might recommend I try?

The staging-next cycle with the fix is still in progress. You can see an overview of the current eval here. There are still ~18k packages queued to build, but the cycle appears to be almost done. Once staging-next is merged into master, it typically takes a few days for the nixos-unstable channel to update. You can track the status of the darwin.ICU PR at https://nixpkgs-tracker.ocfox.me/?pr=360922.

Using this flake, I was able to execute bun install successfully using staging-next as my branch.

$ bun install
bun install v1.1.43 (76800b04)

+ esbuild@0.24.2

2 packages installed [2.56s]
Removed: 2
3 Likes

Thanks so much, @reckenrode! Those links are super useful to me, especially since I’m still super new to all this. Really appreciate your help! Will keep an eye out on the staging-next to master process!

1 Like

im using bun 1.2.0 from nix master and i still see this error:

bun i
[0.09ms] ".env"
bun install v1.2.0 (b0c5a765)

warn: incorrect peer dependency "commander@12.1.0"
  ⚙️  nx [1/5] dyld[74470]: Symbol not found: __ZNK6icu_746number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
  Referenced from: <9AD0784D-AB85-3CA3-B230-684C160BF909> /nix/store/y6piwcsias394n5kflisg8jhll9czk2x-nodejs-22.10.0/bin/node
  Expected in:     <BE55197B-C589-3CC2-AB0E-9230D9C1182C> /nix/store/3si5nghfk2aqzacmwdry7s73b0qbwi23-ICU-74221/lib/libicui18n.74.2.dylib

error: postinstall script from "nx" terminated by SIGABRT (Abort)
[1]    74454 abort      bun i

does it mean the fix doesn’t work or im doing something bad?

Which commit from master are you using?

I am still seeing this too.

Which commit from master are you using?

I am not exactly sure which commit I am looking for (I am seeing nixpkgs, nixpkgs_2, nixpkgs_3, etc. in the lock file.

If I am not mistaken, I need to be looking at nixpkgs_6 and that is at 9d3ae807ebd2981d593cddd0080856873139aa40.

I am able to reproduce it with:

rm node_modules && bun install

I am able get around it with:

bun install --ignore-scripts && bun install

Not sure if relevant, but I am using the text-based bun lockfile.

@reckenrode im using 06d19368af060553e897aa13f83f897d75e39fd8. im also able to reproduce it sometimes like this ^^ + im using text-based bun lockfile

bun i
[0.08ms] ".env"
bun install v1.2.0 (b0c5a765)
  ⚙️  @apollo/protobufjs [1/1] dyld[30919]: Symbol not found: __ZNK6icu_746number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode
  Referenced from: <9AD0784D-AB85-3CA3-B230-684C160BF909> /nix/store/y6piwcsias394n5kflisg8jhll9czk2x-nodejs-22.10.0/bin/node
  Expected in:     <BE55197B-C589-3CC2-AB0E-9230D9C1182C> /nix/store/3si5nghfk2aqzacmwdry7s73b0qbwi23-ICU-74221/lib/libicui18n.74.2.dylib

error: postinstall script from "@apollo/protobufjs" terminated by SIGABRT (Abort)
[1]    30918 abort      bun i
  • when removing the lock-file, the bun i works by migrating the package-lock.json again.

Both errors are occurring in /nix/store/y6piwcsias394n5kflisg8jhll9czk2x-nodejs-22.10.0/bin/node, but that’s not the node binary I get when I use either 06d19368af060553e897aa13f83f897d75e39fd8 or 9d3ae807ebd2981d593cddd0080856873139aa40. You can see below both are using the same Darwin ICU.

$ command -v node
/nix/store/ygk01vha6k5zxgn9rsxi3k6cm2kbnwsc-nodejs-22.12.0/bin/node
$ nix-store -qR $(command -v node)
/nix/store/0iqy9n7x6ygvbcvfz8nv9xj8dbhk9il3-openssl-3.3.2
/nix/store/362f8clra67cg8k8dl15c0bn1x5adj41-libuv-1.49.2
/nix/store/v2qjr45k2qqmjn0sjd5ilc0y9hl06rd6-libcxx-19.1.6
/nix/store/3si5nghfk2aqzacmwdry7s73b0qbwi23-ICU-74221
/nix/store/5syd1v3ki2v5a595r13007brsvch22pj-openssl-3.3.2-bin
/nix/store/iv1k5wr7hbxm51qmdn6l2inq7rd2vfhk-bash-5.2p37
/nix/store/b2048d1gh6dd4qgxcs5gfnxbllslgarx-ICU-74221-dev
/nix/store/h6vk8rkl8yj17s8pw8d1yh7hg04d59s3-zlib-1.3.1
/nix/store/hisigq8ddvszawxxym1qdz0wzwd12iwy-sqlite-3.47.2
/nix/store/ny6lsnsz01w8dkqsrzychdc9ksrsa4wr-sqlite-3.47.2-bin
/nix/store/bsmg36cvdxlxi6gf7cnp8fx33m1hhs3a-sqlite-3.47.2-dev
/nix/store/hyr1h13m2z7yki28rl05d9ha9bbhw1b6-openssl-3.3.2-dev
/nix/store/qx7ir9jjb8j86ylf891d6ki1w3g9gmdy-libuv-1.49.2-dev
/nix/store/w46knb5bp3yqjmh8aw431wpzwdmbl79n-zlib-1.3.1-dev
/nix/store/ygk01vha6k5zxgn9rsxi3k6cm2kbnwsc-nodejs-22.12.0
nix-store -qR $(command -v bun)
/nix/store/v2qjr45k2qqmjn0sjd5ilc0y9hl06rd6-libcxx-19.1.6
/nix/store/3si5nghfk2aqzacmwdry7s73b0qbwi23-ICU-74221
/nix/store/iv1k5wr7hbxm51qmdn6l2inq7rd2vfhk-bash-5.2p37
/nix/store/xxfrmp6y0hpnbi0i4hiqlxs5q03z38ih-bun-1.2.0

Is something in your dev environment locking the node binary? Do you have a dev shell that sets its own node or overrides it in some way? I’m not sure why you’re getting a different node than I am.

1 Like

OKAY! Solved! Thank you @reckenrode for your great response!!

seems like when I run the same commands you run, i got compeltely different dependnecies.

The problem was I was using nodejs 22.10.0 while you are using nodejs 22.12.0

When updating nodejs to the same version from nix, I got the exact same output as you did.

and now bun works great.

–

maybe there were sub and common depependcies between bun and nodejs that were not working well together.

this discussion needs to be published somewhere because seems like bun needs nodejs in a specific version (when there is a nodejs in the system).

Thanks!

1 Like

It worked for me too!!

As you said, I was indeed in a devenv pinned at a different version…

By default, devenv uses a fork of nixpkgs with additional fixes. This fork can be several months behind nixpkgs-unstable .

I followed Common patterns - devenv and was able to set it to a more recent version.

diff --git a/devenv.nix b/devenv.nix
index 1c6c7ae..6a62dee 100644
--- a/devenv.nix
+++ b/devenv.nix
@@ -1,12 +1,14 @@
 { pkgs, lib, config, inputs, ... }:
-
+let
+  pkgs-unstable = import inputs.nixpkgs-unstable { system = pkgs.stdenv.system; };
+in
 { 
   languages.javascript = {
     enable = true;
-    package = pkgs.nodejs_20;
+    package = pkgs-unstable.nodejs_20;
   };
 
diff --git a/devenv.yaml b/devenv.yaml
index 68616a4..94a0e21 100644
--- a/devenv.yaml
+++ b/devenv.yaml
@@ -2,3 +2,5 @@
 inputs:
   nixpkgs:
     url: github:cachix/devenv-nixpkgs/rolling
+  nixpkgs-unstable:
+    url: github:nixos/nixpkgs/nixpkgs-unstable
2 Likes

I don’t think it was the minor version that mattered. The previous nodejs in your environment didn’t have the fix. When you updated, nodejs was updated to a build with the fix, which is to build against the Darwin ICU instead of upstream ICU (so both use the same set of dylibs).