使用Javy命令将JavaScript代码转换为WASM二进制的错误
我正在尝试使用 javy 。 Javy是WebAssembly工具链的JavaScript。它获取您的JavaScript代码并在WebAssembly嵌入式JavaScript运行时执行它。 我已经建立了所有的构建和开发环境。但是之后,当我尝试使用命令将JavaScript代码转换为WASM二进制文件时,
javy index.js -o index.wasm
我会遇到错误:
ajit0902@AJITPC:/mnt/c/Users/msi/javy/target/release$ javy index.js -o index.wasm
Command 'javy' not found, did you mean:
command 'java' from deb openjdk-11-jre-headless (11.0.15+10-0ubuntu0.20.04.1)
command 'java' from deb default-jre (2:1.11-72)
command 'java' from deb openjdk-16-jre-headless (16.0.1+9-1~20.04)
command 'java' from deb openjdk-17-jre-headless (17.0.3+7-0ubuntu0.20.04.1)
command 'java' from deb openjdk-8-jre-headless (8u312-b07-0ubuntu1~20.04)
command 'java' from deb openjdk-13-jre-headless (13.0.7+5-0ubuntu1~20.04)
command 'javr' from deb xc3sprog (0+svn795+dfsg-1build1)
Try: sudo apt install <deb name>
I am trying to compile javascript to wasm using Javy. Javy is a JavaScript to WebAssembly toolchain. It takes your JavaScript code and executes it in a WebAssembly embedded JavaScript runtime.
I have set up all the build and development environment. But after that when I am trying to Convert javascript code to wasm binary using command
javy index.js -o index.wasm
I am getting error like :
ajit0902@AJITPC:/mnt/c/Users/msi/javy/target/release$ javy index.js -o index.wasm
Command 'javy' not found, did you mean:
command 'java' from deb openjdk-11-jre-headless (11.0.15+10-0ubuntu0.20.04.1)
command 'java' from deb default-jre (2:1.11-72)
command 'java' from deb openjdk-16-jre-headless (16.0.1+9-1~20.04)
command 'java' from deb openjdk-17-jre-headless (17.0.3+7-0ubuntu0.20.04.1)
command 'java' from deb openjdk-8-jre-headless (8u312-b07-0ubuntu1~20.04)
command 'java' from deb openjdk-13-jre-headless (13.0.7+5-0ubuntu1~20.04)
command 'javr' from deb xc3sprog (0+svn795+dfsg-1build1)
Try: sudo apt install <deb name>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
导航到/javy/target/Release目录生成WASM二进制文件,您也必须将JavaScript源代码保存在此目录中。
在安装Javy时,您还可以将其作为全局依赖项安装,然后您无需导航到此目录即可使用可执行文件。
然后在命令行中执行以下命令:
执行此命令后,您将在名为index.wasm的目录中使用WebAssembly二进制文件。
使用以下命令执行WASM文件
Navigate to /javy/target/release directory to generate the WASM Binary and You will have to save your JavaScript source code in this directory as well.
While installing javy you can also install it as a global dependency and then you won't need to navigate to this directory in order to make use of the executable.
And then in the command line execute the below command:
After executing this command, you will have the WebAssembly Binary in your directory named index.wasm
Execute the wasm file, using the following command