wasmedge-nodejs-starter
wasmedge-nodejs-starter copied to clipboard
Docs could be better
in ubuntu
Installation needed
- ssvmup
npm i -g ssvmup
- wasm-opt
npm i -g wasm-opt
- node-pre-gyp
npm i -g node-pre-gyp
Errors
// this is the file ssvm_nodejs_starter_lib.js generated by ssvmup build
let vm;
/**
* @param {string} s
* @returns {string}
*/
module.exports.say = function(s) {
if (typeof s === 'object') s = JSON.stringify(s);
return vm.RunString('say', s);
};
const path = require('path').join(__dirname, 'ssvm_nodejs_starter_lib_bg.wasm');
const ssvm = require('ssvm');
vm = new ssvm.VM(path, { args:process.argv, env:process.env, preopens:{'/': __dirname} });
ssvm is a node module? but when installed globally, then run node node/app.js
Error: Cannot find module 'ssvm'
I tried several times, it still failed.
If ssvm is only available from source code/docker. The node module ssvm should be deprecated/deleted.
It's not easy to use it for newbies
Hi, Our document in this repo doesn't contain the manually setup guide. This will be fixed later. If you want to setup the environment, we have a blog to describe this: https://www.secondstate.io/articles/setup-rust-nodejs/
ssvm is a node module? but when installed globally, then run node node/app.js
Yes, ssvm is a node module, you can install it with npm install ssvm
.
And the repository is here: https://github.com/second-state/ssvm-napi
The npm package is here: https://www.npmjs.com/package/ssvm