To install the wasm-bindgen-cli tool, we use the following command:
curl https://sh.rustup.rs -sSf | shinto the terminal. More information can be found on this page.
Aside from a bit lengthy installation process, I didn't have any other issues when using Windows, but on Ubuntu 20.04, I received two installation errors.
The linker `cc` not found error
The first error that appeared was related to the linker.
error: linker `cc` not found
= note: No such file or directory (os error 2)
error: could not compile `libc` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `wasm-bindgen-cli v0.2.84`, intermediate artifacts can be found at ...
The solution was to install the build-essential package, which includes basic tools to compile other packages from the source code.
This fixed the linker error, but when I ran the wasm-bindgen-cli installation again, I got another error.
The "failed to run custom build command for openssl-sys" error
The exact error message displayed was as follows:
process didn't exit successfully: `/tmp/cargo-installbcXvkc/release/build/openssl-sys-972f5eb3ddbebfda/build-script-main` (exit status: 101)
And the solution here was first to install the libssl-dev package, which is a development library for OpenSSL.
But this wasn't enough. I also needed to install the pkg-config package that is used to manage library dependencies.
If we now attempt the installation again, it should succeed. The last line of the installation process should display something like this:
We can verify that the installation was successful by checking the version of the tool: