Skip to content

Fix running babel and terser when there is no node in PATH. #24450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 30, 2025

Conversation

juj
Copy link
Collaborator

@juj juj commented May 30, 2025

Fix running babel as part of the build when there is no node in PATH. Fixes test other.test_wasm_features.

@juj
Copy link
Collaborator Author

juj commented May 30, 2025

Test other.test_em_config_filename was failing for the same reason. It programmatically generates an .emscripten config file, then resulting in an error that node could not be located.

@juj
Copy link
Collaborator Author

juj commented May 30, 2025

And use of terser in other.test_minimal_runtime_code_size_*.

@@ -537,6 +537,9 @@ def transpile(filename):
# in the emscripten tree, so we explicitly set NODE_PATH here.
env = os.environ.copy()
env['NODE_PATH'] = path_from_root('node_modules')
# Babel expects to see 'node' executable in PATH, but it might not exist there
# if we are running Emscripten from Emsdk (which does not add Node/Python to PATH)
env['PATH'] = f'{shared.get_node_directory()}{os.pathsep}{env['PATH']}'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean if I have an old version node in my PATH and new version of node configured in .emscripten (as is the case on my laptop and desktop) that babel will somehow use the old version? How does it fail without node in the PATH exactly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean if I have an old version node in my PATH and new version of node configured in .emscripten (as is the case on my laptop and desktop) that babel will somehow use the old version?

Probably.

How does it fail without node in the PATH exactly?


C:\emsdk\emscripten\main>set EMCC_DEBUG=1

C:\emsdk\emscripten\main>test\runner other.test_wasm_features
config:DEBUG: using config file: C:\emsdk\.emscripten
tools.filelock:DEBUG: Attempting to acquire lock 1424873609200 on C:\Users\clb\AppData\Local\Temp\emscripten_temp\emscripten.lock
tools.filelock:DEBUG: Lock 1424873609200 acquired on C:\Users\clb\AppData\Local\Temp\emscripten_temp\emscripten.lock
shared:DEBUG: successfully executed 'C:/emsdk/binaryen/main_vs2022_64bit_binaryen\bin\wasm-opt.exe' --version
root:DEBUG: Checking JS engine ['C:/emsdk/node/22.16.0_64bit/bin/node.exe']
Running: 'C:/emsdk/node/22.16.0_64bit/bin/node.exe 'C:\emsdk\emscripten\main\test\hello_world.js''
profiler:DEBUG: block "read_ports" took 0.004 seconds
Running test_other: (1 tests)
shared:DEBUG: sanity file up-to-date: C:\emsdk\emscripten\main\cache\sanity.txt
shared:DEBUG: successfully executed C:/emsdk/node/22.16.0_64bit/bin/node.exe --version
shared:DEBUG: successfully executed 'C:/emsdk/llvm/git/build_main_vs2022_64/Release/bin\clang.exe' --version
shared:DEBUG: successfully executed 'C:/emsdk/llvm/git/build_main_vs2022_64/Release/bin\clang.exe' -print-targets
shared:DEBUG: successfully executed C:/emsdk/node/22.16.0_64bit/bin/node.exe -e 'console.log("hello")'
profiler:DEBUG: block "check_node" took 0.029 seconds
profiler:DEBUG: block "sanity LLVM" took 0.000 seconds
profiler:DEBUG: block "check_sanity" took 0.058 seconds
test_wasm_features (test_other.other.test_wasm_features) ... shared:DEBUG: successfully executed C:/emsdk/node/22.16.0_64bit/bin/node.exe --version
common:DEBUG: Clearing existing test directory: C:\emsdk\emscripten\main\out\test
config:DEBUG: using config file: C:\emsdk\.emscripten
profiler:DEBUG: block "read_ports" took 0.004 seconds
emcc:WARNING: invocation: 'C:\emsdk\emscripten\main\emcc.py' 'C:\emsdk\emscripten\main\test\hello_world.c' -c (in C:\emsdk\emscripten\main\out\test)
profiler:DEBUG: block "parse arguments" took 0.000 seconds
profiler:DEBUG: block "check_sanity" took 0.000 seconds
profiler:DEBUG: block "setup" took 0.000 seconds
profiler:DEBUG: block "ensure_sysroot" took 0.000 seconds
shared:DEBUG: executed 'C:/emsdk/llvm/git/build_main_vs2022_64/Release/bin\clang.exe' -target wasm32-unknown-emscripten -fignore-exceptions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr '--sysroot=C:\emsdk\emscripten\main\cache\sysroot' -DEMSCRIPTEN -Xclang '-iwithsysroot/include\fakesdl' -Xclang '-iwithsysroot/include\compat' 'C:\emsdk\emscripten\main\test\hello_world.c' -c
profiler:DEBUG: block "compile inputs" raised an exception after 0.023 seconds
profiler:DEBUG: block "main" raised an exception after 0.024 seconds
shared:DEBUG: successfully executed 'C:\emsdk\emscripten\main\emcc.bat' 'C:\emsdk\emscripten\main\test\hello_world.c' -c
config:DEBUG: using config file: C:\emsdk\.emscripten
profiler:DEBUG: block "read_ports" took 0.004 seconds
emcc:WARNING: invocation: 'C:\emsdk\emscripten\main\emcc.py' 'C:\emsdk\emscripten\main\test\hello_world.c' (in C:\emsdk\emscripten\main\out\test)
profiler:DEBUG: block "parse arguments" took 0.000 seconds
profiler:DEBUG: block "check_sanity" took 0.000 seconds
profiler:DEBUG: block "setup" took 0.000 seconds
profiler:DEBUG: block "ensure_sysroot" took 0.000 seconds
emcc:DEBUG: compiling source file: C:\emsdk\emscripten\main\test\hello_world.c
shared:DEBUG: successfully executed 'C:/emsdk/llvm/git/build_main_vs2022_64/Release/bin\clang.exe' -target wasm32-unknown-emscripten -fignore-exceptions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr '--sysroot=C:\emsdk\emscripten\main\cache\sysroot' -DEMSCRIPTEN -Xclang '-iwithsysroot/include\fakesdl' -Xclang '-iwithsysroot/include\compat' -c 'C:\emsdk\emscripten\main\test\hello_world.c' -o 'C:\Users\clb\AppData\Local\Temp\emscripten_temp\hello_world_0.o'
profiler:DEBUG: block "compile inputs" took 0.019 seconds
shared:DEBUG: successfully executed 'C:/emsdk/llvm/git/build_main_vs2022_64/Release/bin\clang.exe' --version
profiler:DEBUG: block "linker_setup" took 0.009 seconds
profiler:DEBUG: block "calculate linker inputs" took 0.000 seconds
system_libs:DEBUG: including libGL (libGL-getprocaddr.a)
system_libs:DEBUG: including libal (libal.a)
system_libs:DEBUG: including libhtml5 (libhtml5.a)
system_libs:DEBUG: including libstubs (libstubs-debug.a)
system_libs:DEBUG: including libnoexit (libnoexit.a)
system_libs:DEBUG: including libc (libc-debug.a)
system_libs:DEBUG: including libmalloc (libdlmalloc-debug.a)
system_libs:DEBUG: including libcompiler_rt (libcompiler_rt.a)
system_libs:DEBUG: including libc++ (libc++-noexcept.a)
system_libs:DEBUG: including libc++abi (libc++abi-debug-noexcept.a)
system_libs:DEBUG: including libsockets (libsockets.a)
profiler:DEBUG: block "calculate system libraries" took 0.002 seconds
building:DEBUG: saving intermediate file C:\Users\clb\AppData\Local\Temp\emscripten_temp\emcc-00-settings.json
shared:DEBUG: successfully executed C:/emsdk/node/22.16.0_64bit/bin/node.exe 'C:\emsdk\emscripten\main\tools\compiler.mjs' - --symbols-only
profiler:DEBUG: block "compile_javascript" took 0.117 seconds
profiler:DEBUG: block "JS symbol generation" took 0.117 seconds
link:DEBUG: linking: ['C:\\Users\\clb\\AppData\\Local\\Temp\\emscripten_temp\\hello_world_0.o', '-LC:\\emsdk\\emscripten\\main\\cache\\sysroot\\lib\\wasm32-emscripten', '-LC:\\emsdk\\emscripten\\main\\src\\lib', '-lGL-getprocaddr', '-lal', '-lhtml5', '-lstubs-debug', '-lnoexit', '-lc-debug', '-ldlmalloc-debug', '-lcompiler_rt', '-lc++-noexcept', '-lc++abi-debug-noexcept', '-lsockets']
shared:DEBUG: successfully executed 'C:/emsdk/llvm/git/build_main_vs2022_64/Release/bin\wasm-ld.exe' -o a.out.wasm 'C:\Users\clb\AppData\Local\Temp\emscripten_temp\hello_world_0.o' '-LC:\emsdk\emscripten\main\cache\sysroot\lib\wasm32-emscripten' '-LC:\emsdk\emscripten\main\src\lib' -lGL-getprocaddr -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc-debug -lcompiler_rt -lc++-noexcept -lc++abi-debug-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr 'C:\Users\clb\AppData\Local\Temp\emscripten_temp\tmpak189at5libemscripten_js_symbols.so' --strip-debug --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_get_current --export=emscripten_stack_init --export=_emscripten_stack_alloc --export=__wasm_call_ctors --export=_emscripten_stack_restore --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=main --export-if-defined=__main_argc_argv --export-if-defined=fflush --export-table -z stack-size=65536 --no-growable-memory --initial-heap=16777216 --no-entry --stack-first --table-base=1
profiler:DEBUG: block "link" took 0.055 seconds
link:DEBUG: emscript
building:DEBUG: saving intermediate file C:\Users\clb\AppData\Local\Temp\emscripten_temp\emcc-01-base.wasm
building:DEBUG: saving intermediate file C:\Users\clb\AppData\Local\Temp\emscripten_temp\emcc-02-strip.wasm
shared:DEBUG: successfully executed 'C:/emsdk/llvm/git/build_main_vs2022_64/Release/bin\llvm-objcopy.exe' a.out.wasm a.out.wasm '--remove-section=.debug*' --remove-section=producers --remove-section=name
extract_metadata:DEBUG: no start/stop symbols found for section: em_asm
extract_metadata:DEBUG: no start/stop symbols found for section: em_lib_deps
emscripten:DEBUG: Metadata: {'all_exports': ['memory',
                 '__wasm_call_ctors',
                 'main',
                 '__indirect_function_table',
                 'fflush',
                 'strerror',
                 'emscripten_stack_get_end',
                 'emscripten_stack_get_base',
                 'emscripten_stack_init',
                 'emscripten_stack_get_free',
                 '_emscripten_stack_restore',
                 '_emscripten_stack_alloc',
                 'emscripten_stack_get_current'],
 'em_asm_consts': {},
 'em_js_func_types': {},
 'em_js_funcs': {},
 'features': ['--enable-bulk-memory',
              '--enable-bulk-memory-opt',
              '--enable-call-indirect-overlong',
              '--enable-multivalue',
              '--enable-mutable-globals',
              '--enable-nontrapping-float-to-int',
              '--enable-reference-types',
              '--enable-sign-ext'],
 'function_exports': {'__wasm_call_ctors': FuncType(params=[], returns=[]),
                      '_emscripten_stack_alloc': FuncType(params=[<Type.I32: 127>], returns=[<Type.I32: 127>]),
                      '_emscripten_stack_restore': FuncType(params=[<Type.I32: 127>], returns=[]),
                      'emscripten_stack_get_base': FuncType(params=[], returns=[<Type.I32: 127>]),
                      'emscripten_stack_get_current': FuncType(params=[], returns=[<Type.I32: 127>]),
                      'emscripten_stack_get_end': FuncType(params=[], returns=[<Type.I32: 127>]),
                      'emscripten_stack_get_free': FuncType(params=[], returns=[<Type.I32: 127>]),
                      'emscripten_stack_init': FuncType(params=[], returns=[]),
                      'fflush': FuncType(params=[<Type.I32: 127>], returns=[<Type.I32: 127>]),
                      'main': FuncType(params=[<Type.I32: 127>, <Type.I32: 127>], returns=[<Type.I32: 127>]),
                      'strerror': FuncType(params=[<Type.I32: 127>], returns=[<Type.I32: 127>])},
 'global_exports': {},
 'imports': ['fd_write'],
 'invoke_funcs': [],
 'js_deps': [],
 'main_reads_params': False,
 'tag_exports': []}
profiler:DEBUG: block "get_metadata" took 0.009 seconds
emscripten:DEBUG: very limited syscalls (fd_write) so disabling full filesystem support
building:DEBUG: saving intermediate file C:\Users\clb\AppData\Local\Temp\emscripten_temp\emcc-03-settings.json
shared:DEBUG: successfully executed C:/emsdk/node/22.16.0_64bit/bin/node.exe 'C:\emsdk\emscripten\main\tools\compiler.mjs' -
profiler:DEBUG: block "compile_javascript" took 0.112 seconds
building:DEBUG: saving intermediate file C:\Users\clb\AppData\Local\Temp\emscripten_temp\emcc-04-original.js
profiler:DEBUG: block "emscript" took 0.153 seconds
link:DEBUG: using binaryen
profiler:DEBUG: block "binaryen" took 0.000 seconds
root:DEBUG: move: C:\Users\clb\AppData\Local\Temp\emscripten_temp\a.out.js -> a.out.js
profiler:DEBUG: block "final emitting" took 0.001 seconds
profiler:DEBUG: block "post link" took 0.155 seconds
emcc:DEBUG: total time: 0.37 seconds
profiler:DEBUG: block "main" took 0.367 seconds
not cleaning up temp files since in debug-save mode, see them in C:\Users\clb\AppData\Local\Temp\emscripten_temp
shared:DEBUG: successfully executed 'C:\emsdk\emscripten\main\emcc.bat' 'C:\emsdk\emscripten\main\test\hello_world.c'
config:DEBUG: using config file: C:\emsdk\.emscripten
profiler:DEBUG: block "read_ports" took 0.004 seconds
emcc:WARNING: invocation: 'C:\emsdk\emscripten\main\emcc.py' 'C:\emsdk\emscripten\main\test\hello_world.c' -mno-sign-ext -c (in C:\emsdk\emscripten\main\out\test)
profiler:DEBUG: block "parse arguments" took 0.000 seconds
profiler:DEBUG: block "check_sanity" took 0.000 seconds
profiler:DEBUG: block "setup" took 0.000 seconds
profiler:DEBUG: block "ensure_sysroot" took 0.000 seconds
shared:DEBUG: executed 'C:/emsdk/llvm/git/build_main_vs2022_64/Release/bin\clang.exe' -target wasm32-unknown-emscripten -fignore-exceptions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr '--sysroot=C:\emsdk\emscripten\main\cache\sysroot' -DEMSCRIPTEN -Xclang '-iwithsysroot/include\fakesdl' -Xclang '-iwithsysroot/include\compat' 'C:\emsdk\emscripten\main\test\hello_world.c' -mno-sign-ext -c
profiler:DEBUG: block "compile inputs" raised an exception after 0.025 seconds
profiler:DEBUG: block "main" raised an exception after 0.026 seconds
shared:DEBUG: successfully executed 'C:\emsdk\emscripten\main\emcc.bat' 'C:\emsdk\emscripten\main\test\hello_world.c' -mno-sign-ext -c
config:DEBUG: using config file: C:\emsdk\.emscripten
profiler:DEBUG: block "read_ports" took 0.004 seconds
emcc:WARNING: invocation: 'C:\emsdk\emscripten\main\emcc.py' 'C:\emsdk\emscripten\main\test\hello_world.c' -sMIN_FIREFOX_VERSION=61 (in C:\emsdk\emscripten\main\out\test)
profiler:DEBUG: block "parse arguments" took 0.000 seconds
profiler:DEBUG: block "check_sanity" took 0.000 seconds
profiler:DEBUG: block "setup" took 0.000 seconds
profiler:DEBUG: block "ensure_sysroot" took 0.000 seconds
emcc:DEBUG: compiling source file: C:\emsdk\emscripten\main\test\hello_world.c
shared:DEBUG: successfully executed 'C:/emsdk/llvm/git/build_main_vs2022_64/Release/bin\clang.exe' -target wasm32-unknown-emscripten -fignore-exceptions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr '--sysroot=C:\emsdk\emscripten\main\cache\sysroot' -DEMSCRIPTEN -Xclang '-iwithsysroot/include\fakesdl' -Xclang '-iwithsysroot/include\compat' -c 'C:\emsdk\emscripten\main\test\hello_world.c' -o 'C:\Users\clb\AppData\Local\Temp\emscripten_temp\hello_world_0.o'
profiler:DEBUG: block "compile inputs" took 0.019 seconds
shared:DEBUG: successfully executed 'C:/emsdk/llvm/git/build_main_vs2022_64/Release/bin\clang.exe' --version
feature_matrix:DEBUG: cannot use GLOBALTHIS because MIN_FIREFOX_VERSION is too old: 61
feature_matrix:DEBUG: cannot use PROMISE_ANY because MIN_FIREFOX_VERSION is too old: 61
feature_matrix:DEBUG: cannot use BULK_MEMORY because MIN_FIREFOX_VERSION is too old: 61
feature_matrix:DEBUG: cannot use JS_BIGINT_INTEGRATION because MIN_FIREFOX_VERSION is too old: 61
profiler:DEBUG: block "linker_setup" took 0.033 seconds
profiler:DEBUG: block "calculate linker inputs" took 0.000 seconds
system_libs:DEBUG: including libGL (libGL-getprocaddr.a)
system_libs:DEBUG: including libal (libal.a)
system_libs:DEBUG: including libhtml5 (libhtml5.a)
system_libs:DEBUG: including libstubs (libstubs-debug.a)
system_libs:DEBUG: including libnoexit (libnoexit.a)
system_libs:DEBUG: including libc (libc-debug.a)
system_libs:DEBUG: including libmalloc (libdlmalloc-debug.a)
system_libs:DEBUG: including libcompiler_rt (libcompiler_rt.a)
system_libs:DEBUG: including libc++ (libc++-noexcept.a)
system_libs:DEBUG: including libc++abi (libc++abi-debug-noexcept.a)
system_libs:DEBUG: including libsockets (libsockets.a)
profiler:DEBUG: block "calculate system libraries" took 0.002 seconds
building:DEBUG: saving intermediate file C:\Users\clb\AppData\Local\Temp\emscripten_temp\emcc-00-settings.json
shared:DEBUG: successfully executed C:/emsdk/node/22.16.0_64bit/bin/node.exe 'C:\emsdk\emscripten\main\tools\compiler.mjs' - --symbols-only
profiler:DEBUG: block "compile_javascript" took 0.122 seconds
profiler:DEBUG: block "JS symbol generation" took 0.123 seconds
link:DEBUG: linking: ['C:\\Users\\clb\\AppData\\Local\\Temp\\emscripten_temp\\hello_world_0.o', '-LC:\\emsdk\\emscripten\\main\\cache\\sysroot\\lib\\wasm32-emscripten', '-LC:\\emsdk\\emscripten\\main\\src\\lib', '-lGL-getprocaddr', '-lal', '-lhtml5', '-lstubs-debug', '-lnoexit', '-lc-debug', '-ldlmalloc-debug', '-lcompiler_rt', '-lc++-noexcept', '-lc++abi-debug-noexcept', '-lsockets']
shared:DEBUG: successfully executed 'C:/emsdk/llvm/git/build_main_vs2022_64/Release/bin\wasm-ld.exe' -o a.out.wasm 'C:\Users\clb\AppData\Local\Temp\emscripten_temp\hello_world_0.o' '-LC:\emsdk\emscripten\main\cache\sysroot\lib\wasm32-emscripten' '-LC:\emsdk\emscripten\main\src\lib' -lGL-getprocaddr -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc-debug -lcompiler_rt -lc++-noexcept -lc++abi-debug-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr 'C:\Users\clb\AppData\Local\Temp\emscripten_temp\tmphvmlb4uflibemscripten_js_symbols.so' --strip-debug --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_get_current --export=emscripten_stack_init --export=_emscripten_stack_alloc --export=__get_temp_ret --export=__set_temp_ret --export=__wasm_call_ctors --export=_emscripten_stack_restore --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=main --export-if-defined=__main_argc_argv --export-if-defined=fflush --export-table -z stack-size=65536 --no-growable-memory --initial-heap=16777216 --no-entry --stack-first --table-base=1
profiler:DEBUG: block "link" took 0.057 seconds
link:DEBUG: emscript
building:DEBUG: saving intermediate file C:\Users\clb\AppData\Local\Temp\emscripten_temp\emcc-01-base.wasm
building:DEBUG: saving intermediate file C:\Users\clb\AppData\Local\Temp\emscripten_temp\emcc-02-strip.wasm
shared:DEBUG: successfully executed 'C:/emsdk/llvm/git/build_main_vs2022_64/Release/bin\llvm-objcopy.exe' a.out.wasm a.out.wasm '--remove-section=.debug*' --remove-section=producers --remove-section=name
extract_metadata:DEBUG: no start/stop symbols found for section: em_asm
extract_metadata:DEBUG: no start/stop symbols found for section: em_lib_deps
shared:DEBUG: successfully executed 'C:/emsdk/binaryen/main_vs2022_64bit_binaryen\bin\wasm-opt.exe' --version
shared:DEBUG: successfully executed 'C:/emsdk/binaryen/main_vs2022_64bit_binaryen\bin\wasm-emscripten-finalize' --dyncalls-i64 --pass-arg=legalize-js-interface-exported-helpers a.out.wasm -o a.out.wasm --detect-features
building:DEBUG: saving intermediate file C:\Users\clb\AppData\Local\Temp\emscripten_temp\emcc-03-wasm-emscripten-finalize.wasm
emscripten:DEBUG: Metadata: {'all_exports': ['memory',
                 '__wasm_call_ctors',
                 'main',
                 '__indirect_function_table',
                 'fflush',
                 'strerror',
                 'emscripten_stack_get_end',
                 'emscripten_stack_get_base',
                 'emscripten_stack_init',
                 'emscripten_stack_get_free',
                 '_emscripten_stack_restore',
                 '_emscripten_stack_alloc',
                 'emscripten_stack_get_current',
                 'dynCall_jiji'],
 'em_asm_consts': {},
 'em_js_func_types': {},
 'em_js_funcs': {},
 'features': ['--enable-bulk-memory',
              '--enable-bulk-memory-opt',
              '--enable-call-indirect-overlong',
              '--enable-multivalue',
              '--enable-mutable-globals',
              '--enable-nontrapping-float-to-int',
              '--enable-reference-types',
              '--enable-sign-ext'],
 'function_exports': {'__wasm_call_ctors': FuncType(params=[], returns=[]),
                      '_emscripten_stack_alloc': FuncType(params=[<Type.I32: 127>], returns=[<Type.I32: 127>]),
                      '_emscripten_stack_restore': FuncType(params=[<Type.I32: 127>], returns=[]),
                      'dynCall_jiji': FuncType(params=[<Type.I32: 127>, <Type.I32: 127>, <Type.I32: 127>, <Type.I32: 127>, <Type.I32: 127>], returns=[<Type.I32: 127>]),
                      'emscripten_stack_get_base': FuncType(params=[], returns=[<Type.I32: 127>]),
                      'emscripten_stack_get_current': FuncType(params=[], returns=[<Type.I32: 127>]),
                      'emscripten_stack_get_end': FuncType(params=[], returns=[<Type.I32: 127>]),
                      'emscripten_stack_get_free': FuncType(params=[], returns=[<Type.I32: 127>]),
                      'emscripten_stack_init': FuncType(params=[], returns=[]),
                      'fflush': FuncType(params=[<Type.I32: 127>], returns=[<Type.I32: 127>]),
                      'main': FuncType(params=[<Type.I32: 127>, <Type.I32: 127>], returns=[<Type.I32: 127>]),
                      'strerror': FuncType(params=[<Type.I32: 127>], returns=[<Type.I32: 127>])},
 'global_exports': {},
 'imports': ['fd_write'],
 'invoke_funcs': [],
 'js_deps': [],
 'main_reads_params': False,
 'tag_exports': []}
profiler:DEBUG: block "get_metadata" took 0.028 seconds
emscripten:DEBUG: very limited syscalls (fd_write) so disabling full filesystem support
building:DEBUG: saving intermediate file C:\Users\clb\AppData\Local\Temp\emscripten_temp\emcc-04-settings.json
shared:DEBUG: successfully executed C:/emsdk/node/22.16.0_64bit/bin/node.exe 'C:\emsdk\emscripten\main\tools\compiler.mjs' -
profiler:DEBUG: block "compile_javascript" took 0.117 seconds
building:DEBUG: saving intermediate file C:\Users\clb\AppData\Local\Temp\emscripten_temp\emcc-05-original.js
profiler:DEBUG: block "emscript" took 0.185 seconds
link:DEBUG: using binaryen
feature_matrix:DEBUG: cannot use SIGN_EXT because MIN_FIREFOX_VERSION is too old: 61
link:DEBUG: lowering sign-ext feature due to incompatible target browser engines
feature_matrix:DEBUG: cannot use NON_TRAPPING_FPTOINT because MIN_FIREFOX_VERSION is too old: 61
link:DEBUG: lowering nontrapping-fp feature due to incompatible target browser engines
feature_matrix:DEBUG: cannot use BULK_MEMORY because MIN_FIREFOX_VERSION is too old: 61
link:DEBUG: lowering bulk-memory feature due to incompatible target browser engines
shared:DEBUG: successfully executed 'C:/emsdk/binaryen/main_vs2022_64bit_binaryen\bin\wasm-opt' --signext-lowering --llvm-nontrapping-fptoint-lowering --llvm-memory-copy-fill-lowering a.out.wasm -o a.out.wasm --mvp-features --enable-bulk-memory --enable-bulk-memory-opt --enable-call-indirect-overlong --enable-multivalue --enable-mutable-globals --enable-nontrapping-float-to-int --enable-reference-types --enable-sign-ext
building:DEBUG: saving intermediate file C:\Users\clb\AppData\Local\Temp\emscripten_temp\emcc-06-wasm-opt.wasm
building:DEBUG: saving intermediate file C:\Users\clb\AppData\Local\Temp\emscripten_temp\emcc-07-byn.wasm
profiler:DEBUG: block "wasm_opt" took 0.017 seconds
building:DEBUG: {
  "sourceType": "script",
  "presets": [
    "@babel/preset-env"
  ],
  "targets": {
    "chrome": "85",
    "firefox": "61",
    "safari": "15.0.0",
    "node": "16.0.0"
  }
}
'"node"' is not recognized as an internal or external command,
operable program or batch file.
emcc: error: ''C:\emsdk\emscripten\main\node_modules\.bin\babel.cmd' 'C:\Users\clb\AppData\Local\Temp\emscripten_temp\a.out.js' -o 'C:\Users\clb\AppData\Local\Temp\emscripten_temp\tmpsg87da4hbabel.js' --config-file 'C:\Users\clb\AppData\Local\Temp\emscripten_temp\tmpos6_6wmpbabel_config.json'' failed (returned 1)
profiler:DEBUG: block "transpile" raised an exception after 0.014 seconds
profiler:DEBUG: block "transpile" raised an exception after 0.014 seconds
profiler:DEBUG: block "binaryen" raised an exception after 0.032 seconds
profiler:DEBUG: block "post link" raised an exception after 0.218 seconds
profiler:DEBUG: block "main" raised an exception after 0.458 seconds
not cleaning up temp files since in debug-save mode, see them in C:\Users\clb\AppData\Local\Temp\emscripten_temp
None
None
FAIL

======================================================================
FAIL: test_wasm_features (test_other.other.test_wasm_features)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\emsdk\emscripten\main\test\common.py", line 1776, in run_process
    return shared.run_process(cmd, check=check, **args)
           ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\emsdk\emscripten\main\tools\shared.py", line 113, in run_process
    ret = subprocess.run(cmd, check=check, input=input, *args, **kw)
  File "C:\emsdk\python\3.13.3_64bit\Lib\subprocess.py", line 577, in run
    raise CalledProcessError(retcode, process.args,
                             output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['C:\\emsdk\\emscripten\\main\\emcc.bat', 'C:\\emsdk\\emscripten\\main\\test\\hello_world.c', '-sMIN_FIREFOX_VERSION=61']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\emsdk\emscripten\main\test\test_other.py", line 11076, in test_wasm_features
    compile(['-sMIN_FIREFOX_VERSION=61'])
    ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\emsdk\emscripten\main\test\test_other.py", line 11053, in compile
    self.run_process([EMCC, test_file('hello_world.c')] + flags)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\emsdk\emscripten\main\test\common.py", line 1781, in run_process
    self.fail(f'subprocess exited with non-zero return code({e.returncode}): `{shlex.join(cmd)}`')
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: subprocess exited with non-zero return code(1): `'C:\emsdk\emscripten\main\emcc.bat' 'C:\emsdk\emscripten\main\test\hello_world.c' -sMIN_FIREFOX_VERSION=61`

----------------------------------------------------------------------
Ran 1 test in 1.430s

FAILED (failures=1)
tools.filelock:DEBUG: Attempting to release lock 1424873609200 on C:\Users\clb\AppData\Local\Temp\emscripten_temp\emscripten.lock
tools.filelock:DEBUG: Lock 1424873609200 released on C:\Users\clb\AppData\Local\Temp\emscripten_temp\emscripten.lock

C:\emsdk\emscripten\main>

Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see is the .cmd launcher scripts in node_modules/.bin. It might be a windows-only thing, let me see.

@sbc100
Copy link
Collaborator

sbc100 commented May 30, 2025

Ah I see is the .cmd launcher scripts in node_modules/.bin. It might be a windows-only thing, let me see.

Ah yes it does looks like it depends on node being in the PATH on linux too. The launcher script looks like:

#!/usr/bin/env node                                                                  
                                                                                     
require("../lib/babel");        

@sbc100
Copy link
Collaborator

sbc100 commented May 30, 2025

I guess we need to refactor get_npm_cmd so it maybe returns a cmd + env pair? Or would could convert it to run_npm_cmd so it can take care of running the process in the correct env too

@juj
Copy link
Collaborator Author

juj commented May 30, 2025

I guess we need to refactor get_npm_cmd so it maybe returns a cmd + env pair? Or would could convert it to run_npm_cmd so it can take care of running the process in the correct env too

Looks like we already have a shared.env_with_node_in_path() for this. Updated to use that.

@juj juj changed the title Fix running babel as part of the build when there is no node in PATH. Fix running babel and terser when there is no node in PATH. May 30, 2025
@juj juj force-pushed the fix_other_test_wasm_features branch from 23d65ec to fff8969 Compare May 30, 2025 21:02
@juj juj enabled auto-merge (squash) May 30, 2025 21:15
@juj juj merged commit 960fe78 into emscripten-core:main May 30, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants