Pnpm install sdk-react: isolated-vm error

Node: 20.12.2(brew install node@20)
pnpm:8.15.2

.../node_modules/isolated-vm install$ prebuild-install || (node-gyp rebuild --release -j max && node-gyp clean)
│ prebuild-install warn install No prebuilt binaries found (target=20.12.2 runtime=node arch=arm64 libc= platform=darwin)
│ gyp info it worked if it ends with ok
│ gyp info using node-gyp@9.4.1
│ gyp info using node@20.12.2 | darwin | arm64
│ gyp info find Python using Python version 3.12.2 found at "/opt/homebrew/opt/python@3.12/bin/python3.12"
│ gyp info spawn /opt/homebrew/opt/python@3.12/bin/python3.12
│ gyp info spawn args [
│ gyp info spawn args   '/opt/homebrew/lib/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py',
│ gyp info spawn args   'binding.gyp',
│ gyp info spawn args   '-f',
│ gyp info spawn args   'make',
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/Users/radis/dev/next-monorepo/node_modules/.pnpm/isolated-vm@4.7.2/node_modules/isolated-vm/build/config.gypi',
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/opt/homebrew/lib/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi',
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/Users/radis/Library/Caches/node-gyp/20.12.2/include/node/common.gypi',
│ gyp info spawn args   '-Dlibrary=shared_library',
│ gyp info spawn args   '-Dvisibility=default',
│ gyp info spawn args   '-Dnode_root_dir=/Users/radis/Library/Caches/node-gyp/20.12.2',
│ gyp info spawn args   '-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/pnpm/dist/node_modules/node-gyp',
│ gyp info spawn args   '-Dnode_lib_file=/Users/radis/Library/Caches/node-gyp/20.12.2/<(target_arch)/node.lib',
│ gyp info spawn args   '-Dmodule_root_dir=/Users/radis/dev/next-monorepo/node_modules/.pnpm/isolated-vm@4.7.2/node_modules/isolated-vm',
│ gyp info spawn args   '-Dnode_engine=v8',
│ gyp info spawn args   '--depth=.',
│ gyp info spawn args   '--no-parallel',
│ gyp info spawn args   '--generator-output',
│ gyp info spawn args   'build',
│ gyp info spawn args   '-Goutput_dir=.'
│ gyp info spawn args ]
│ Traceback (most recent call last):
│   File "/opt/homebrew/lib/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
│     import gyp  # noqa: E402
│     ^^^^^^^^^^
│   File "/opt/homebrew/lib/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
│     import gyp.input
│   File "/opt/homebrew/lib/node_modules/pnpm/dist/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
│     from distutils.version import StrictVersion
│ ModuleNotFoundError: No module named 'distutils'
│ gyp ERR! configure error 
│ gyp ERR! stack Error: `gyp` failed with exit code: 1
│ gyp ERR! stack     at ChildProcess.onCpExit (/opt/homebrew/lib/node_modules/pnpm/dist/node_modules/node-gyp/lib/configure.js:325:16)
│ gyp ERR! stack     at ChildProcess.emit (node:events:518:28)
│ gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
│ gyp ERR! System Darwin 23.4.0
│ gyp ERR! command "/opt/homebrew/Cellar/node@20/20.12.2/bin/node" "/opt/homebrew/lib/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release" "-j" "max"
│ gyp ERR! cwd /Users/radis/dev/next-monorepo/node_modules/.pnpm/isolated-vm@4.7.2/node_modules/isolated-vm
│ gyp ERR! node -v v20.12.2
│ gyp ERR! node-gyp -v v9.4.1
│ gyp ERR! not ok 
└─ Failed in 2.1s at /Users/radis/dev/next-monorepo/node_modules/.pnpm/isolated-vm@4.7.2/node_modules/isolated-vm
 ELIFECYCLE  Command failed with exit code 1.

Hello @RadisLuo,

We have released v1.0.21 of the React Gen 2 SDK with a fix regarding this issue. Read the changelog carefully for details: builder/packages/sdks/output/react/CHANGELOG.md at main · BuilderIO/builder · GitHub

There is also a documentation page up explaining how to use the workaround:

However, I encountered an error when using pnpm install to install dependencies, not during execution.

Hello @RadisLuo,

You can try providing NODE_OPTIONS=--no-node-snapshot to the command that runs your server and see if that fixes the issue for you.

Additionally, you can try using a different version of node.

Thanks,

Can you please help me with this problem? Thank you