wasmedge-nodejs-starter icon indicating copy to clipboard operation
wasmedge-nodejs-starter copied to clipboard

Docs could be better

Open NaturelLee opened this issue 4 years ago • 1 comments

in ubuntu

Installation needed

  1. ssvmup
npm i -g ssvmup
  1. wasm-opt
npm i -g wasm-opt
  1. 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

NaturelLee avatar Feb 07 '21 09:02 NaturelLee

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

hydai avatar Feb 07 '21 10:02 hydai