wasm-emscripten-finalize command not found

In this troubleshooting guide we learn how to fix wasm-emscripten-finalize command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

wasm-emscripten-finalize: command not found

or when using sudo you get the following error message

sudo: wasm-emscripten-finalize: command not found

Solutions to wasm-emscripten-finalize: command not found

How To Fix wasm-emscripten-finalize: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu wasm-emscripten-finalize is provided by binaryen package.

binaryen is:

Binaryen is a compiler and toolchain infrastructure library for WebAssembly, written in C++. It aims to make compiling to WebAssembly easy, fast, and effective:

  • Easy: Binaryen has a simple C API in a single header, and can also be used from JavaScript. It accepts input in WebAssembly-like form but also accepts a general control flow graph for compilers that prefer that.

  • Fast: Binaryen’s internal IR uses compact data structures and is designed for completely parallel codegen and optimization, using all available CPU cores. Binaryen’s IR also compiles down to WebAssembly extremely easily and quickly because it is essentially a subset of WebAssembly.

  • Effective: Binaryen’s optimizer has many passes that can improve code very significantly (e.g. local coloring to coalesce local variables; dead code elimination; precomputing expressions when possible at compile time; etc.). These optimizations aim to make Binaryen powerful enough to be used as a compiler backend by itself. One specific area of focus is on WebAssembly-specific optimizations (that general-purpose compilers might not do), which you can think of as wasm minification , similar to minification for JavaScript, CSS, etc., all of which are language-specific (an example of such an optimization is block return value generation in SimplifyLocals).

To fix this problem, we can install more using the command below.

sudo apt-get -y install binaryen

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install binaryen.

sudo apt -y install binaryen

Or if you have aptitude installed you can use the following command.

sudo aptitude install binaryen

Summary

In this tutorial we learn how to fix wasm-emscripten-finalize command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.