Code Monkey home page Code Monkey logo

webassembly's Introduction

webassembly
for node.js

An experimental, minimal toolkit and runtime on top of node to produce and run WebAssembly modules.

To run compiled WebAssembly modules, you'll either need a recent version of your browser with WebAssembly enabled or node.js 8 - but you probably already know that. For development, node.js 6 upwards is sufficient.

npm build status Code Climate npm downloads

Motivation

Prevalent WebAssembly tooling provides compilation to WebAssembly from a C/C++ perspective with a focus on porting existing code. Because of that, it usually produces a lot of extra code that isn't needed alongside a module that is solely trying to complement JavaScript. This package, on the other hand, tries to keep the support library and the generated modules as small as possible by specifically targeting WebAssembly (in the browser) only.

PRs welcome!

Example

Write your module as a C program:

// program.c
#include <webassembly.h>

export int add(int a, int b) {
  return a + b;
}

Compile it to wasm:

$> wa compile -o program.wasm program.c

Run it:

// program.js
require("webassembly")
  .load("program.wasm")
  .then(module => {
    console.log("1 + 2 = " + module.exports.add(1, 2));
  });

Installation

As a dependency:

$> npm install webassembly

OR to use globally with "wa compile":

$> npm install -g webassembly

Installing the package automatically downloads prebuilt binaries for either Windows (win32-x64) or Linux (linux-x64).

Toolkit

WebAssembly functionality is provided by a C header. A small JavaScript support library (distributions) provides the browser runtime.

Calling webassembly.load(file: string, [options: LoadOptions]): Promise<IModule> returns a promise for a module instance:

  • module.exports contains exported functions
  • module.memory references the memory instance
  • module.env references the environment used

Available LoadOptions:

  • imports: Object specifies imported functions
  • initialMemory: number specifies the initial amount of memory in 64k pages (defaults to 1)
  • maximumMemory: number specifies the maximum amount of memory in 64k pages that the module is allowed to grow to (optional)

C features available out of the box:

  • Stripped down standard C library based on musl and dlmalloc
  • import and export defines to mark your imports and exports
  • Browser bindings for console and Math (i.e console.log becomes console_log)

Console functions accept the following string substitutions with variable arguments:

Subst. C type Description
%d, %i int / int32_t Signed 32 bit integer
%u unsigned int / uint32_t Unsigned 32 bit integer
%f float 32 bit float
%lf double 64 bit double
%s char * String (zero terminated)

Browser Math (i.e. Math_sqrt) as well as standard C math.h can be used.

On the JS side of things, the memory instance (module.memory) has additional mixed in utility methods for convenient memory access:

  • memory.getInt(ptr: number): number gets the signed 32 bit integer at the specified address (aligned to 4 bytes)
  • memory.getUint(ptr: number): number gets the unsigned 32 bit integer at the specified address (aligned to 4 bytes)
  • memory.getFloat(ptr: number): number gets the 32 bit float at the specified address (aligned to 4 bytes)
  • memory.getDouble(ptr: number): number gets the 64 bit double at the specified address (aligned to 8 bytes)
  • memory.getString(ptr: number): string gets the zero terminated string literal at the specified address

The underlying typed array views are also available for direct use. Just make sure to access them directly on the memory instance because they are updated when the program memory grows.

  • memory.U8: Uint8Array
  • memory.U32: Uint32Array
  • memory.S32: Int32Array
  • memory.F32: Float32Array
  • memory.F64: Float64Array

Command line

The wa-compile utility (also callable as wa compile, wa comp, wa c) compiles C code to a WebAssembly module.

  -o, --out        Specifies the .wasm output file. Defaults to stdout.
  -d, --debug      Prints debug information to stderr.
  -q, --quiet      Suppresses informatory output.

  Module configuration:

  -O, --optimize   Optimizes the output file and removes dead code.
  -s, --stack      Specifies the stack size. Defaults to 10000.
  -m, --main       Executes the specified function on load.
  -D, --define     Defines a macro.

  Includes and libraries:

  -I, --headers    Includes C headers from the specified directories.
  -i, --include    Includes the specified source files.
  -l, --link       Links in the specified libraries after compilation.
  -b, --bare       Does not include the runtime library.

usage: wa-compile [options] program.c

The wa-link utility (also callable as wa link, wa ln, wa l) linkes multiple WebAssembly modules to one.

  -o, --out      Specifies the .wasm output file. Defaults to write to stdout.
  -d, --debug    Prints debug information to stderr.
  -q, --quiet    Suppresses informatory output.

  Module configuration:

  -O, --optimize   Performs link-time optimizations.

usage: wa-link [options] program1.wasm program2.wasm

The wa-disassemble utility (also callable as wa disassemble, wa dis, wa d) decompiles a WebAssembly module to text format.

  -o, --out      Specifies the .wast output file. Defaults to stdout.
  -d, --debug    Prints debug information to stderr.
  -q, --quiet    Suppresses informatory output.

usage: wa-disassemble [options] program.wasm

The wa-assemble utility (also callable as wa assemble, wa as, wa a) assembles WebAssembly text format to a module.

  -o, --out        Specifies the .wasm output file. Defaults to stdout.
  -d, --debug      Prints debug information to stderr.
  -q, --quiet      Suppresses informatory output.

  Module configuration:

  -O, --optimize   Optimizes the output file and removes dead code.

usage: wa-assemble [options] program.wast

The wa utility proxies to the above, in case you don't like typing -.

Command line utilites can also be used programmatically by providing command line arguments and a callback to their respective main functions:

var compiler = require("webassembly/cli/compiler");
               // or assembler, disassembler, linker
compiler.main([
  "-o", "program.wasm",
  "program.c"
], function(err, filename) {
  if (err)
    throw err;
  console.log("saved to: " + filename);
});

IDE integration

Anything should work as long as you are able to configure it, even notepad.

I am using:


License: MIT License.

Includes parts of

WebAssembly logo by Carlos Baraza (CC0 1.0 Universal).

webassembly's People

Contributors

chicoxyzzy avatar dcodeio avatar edza avatar erikdesjardins avatar jnordberg avatar rongjiecomputer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webassembly's Issues

Working examples

Considering submitting a PR adding an examples folder with proper npm scripts/build process in place for users to easily npm install && npm start to get up and running.

Thoughts? Would this be likely to get accepted?

Edit: I've missed this PR ca9b195, it would be a more in depth version of this I guess

LinkError when enabling compiler optimization

When passing -O to cli/compiler I'm getting in the compiled module:
LinkError: WebAssembly Instantiation: Import #3 module="env" function="memset" error: function import requires a callable at <anonymous>

I'm using malloc in my code, the compiler arguments look like this:

let args = [
  "-O",
  "-q",
  "-o", "./wasm_tmp.wasm",
  "src/main.c"
];

Cannot install on wsl

I tried to install webassembly on my wsl, but got the following errors

 ⚡ root > npm install -g webassembly
npm WARN deprecated [email protected]: ⚠️  WARNING ⚠️ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar
/usr/local/bin/wa -> /usr/local/lib/node_modules/webassembly/bin/wa
/usr/local/bin/wa-compile -> /usr/local/lib/node_modules/webassembly/bin/wa-compile
/usr/local/bin/wa-assemble -> /usr/local/lib/node_modules/webassembly/bin/wa-assemble
/usr/local/bin/wa-disassemble -> /usr/local/lib/node_modules/webassembly/bin/wa-disassemble

> [email protected] postinstall /usr/local/lib/node_modules/webassembly
> node scripts/setup

sh: 1: node: Permission denied
npm ERR! Linux 4.4.0-43-Microsoft
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "webassembly"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! [email protected] postinstall: `node scripts/setup`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'node scripts/setup'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the webassembly package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/setup
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs webassembly
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls webassembly
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/npm-debug.log

log is here: npm-debug.log

What is more interesting is that there's no webassembly folder under nodes_modules folder after install:

 ⚡ root > ls -al /usr/local/lib/node_modules
total 0
drwxr-xr-x 0 root   root 512 Oct 23 14:36 .
drwxr-xr-x 0 root   root 512 Oct 23 11:45 ..
drwxrwxrwx 0 root   root 512 Oct 23 14:27 tar
drwxrwxrwx 0 nobody root 512 Oct 23 14:31 wargo

But still, /usr/local/bin/wa is present.

FAILED Error: spawn EACCES

When I follow the steps for running the example here, I run into an error regarding access rights. Is there some more set up that isn't mentioned here that I could be missing?

I'm running node v6.11.1

I get the same error if I use sudo as well.

❯ wa compile -o program.wasm program.c
Compiling on darwin-x64 ...

clang program.c
 -c
 --target=wasm32-unknown-unknown
 -emit-llvm
 -nostdinc
 -nostdlib
 -D WEBASSEMBLY
 -isystem /Users/nick/.nvm/versions/node/v5.12.0/lib/node_modules/webassembly/include
 -o /var/folders/4f/gjs6r6bj2xqcx4dmh91_njl00000gn/T/wa1_216779hYBi2Zw1d18.tmp

FAILED Error: spawn EACCES
    at exports._errnoException (util.js:893:11)
    at ChildProcess.spawn (internal/child_process.js:302:11)
    at Object.exports.spawn (child_process.js:367:9)
    at /Users/nick/.nvm/versions/node/v5.12.0/lib/node_modules/webassembly/cli/util.js:33:34
    at Object.run (/Users/nick/.nvm/versions/node/v5.12.0/lib/node_modules/webassembly/cli/util.js:32:12)
    at Object.exports.main.defines.forEach.headers.forEach.include.forEach [as main] (/Users/nick/.nvm/versions/node/v5.12.0/lib/node_
modules/webassembly/cli/compiler.js:108:10)
    at Object.<anonymous> (/Users/nick/.nvm/versions/node/v5.12.0/lib/node_modules/webassembly/bin/wa-compile:2:38)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)

Can't compile webassembly.h from cpp file

wa compile throws 4 errors when trying to compile a c++ file that imports the webassembly header.

You can reproduce it by copying the example code in the readme into a file named program.cpp and trying to run wa compile -o program.wasm program.cpp.

Output:

Compiling on darwin-x64 ...

clang program.cpp 
 -c 
 --target=wasm32-unknown-unknown 
 -emit-llvm 
 -nostdinc 
 -nostdlib 
 -D WEBASSEMBLY 
 -isystem /Users/emurray/.nvm/versions/node/v7.7.3/lib/node_modules/webassembly/include 
 -o /var/folders/ts/rnwyskln05vg3cbkgl5d4s5xb72qlv/T/wa1_1788ixvKyawdM9VX.tmp

In file included from program.cpp:1:
In file included from /Users/emurray/.nvm/versions/node/v7.7.3/lib/node_modules/webassembly/include/webassembly.h:16:
/Users/emurray/.nvm/versions/node/v7.7.3/lib/node_modules/webassembly/include/uchar.h:17:35: error: C++ requires a type specifier for all declarations
size_t c16rtomb(char *__restrict, char16_t, mbstate_t *__restrict);
                                  ^
/Users/emurray/.nvm/versions/node/v7.7.3/lib/node_modules/webassembly/include/uchar.h:18:17: error: unknown type name 'char16_t'
size_t mbrtoc16(char16_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
                ^
/Users/emurray/.nvm/versions/node/v7.7.3/lib/node_modules/webassembly/include/uchar.h:20:35: error: C++ requires a type specifier for all declarations
size_t c32rtomb(char *__restrict, char32_t, mbstate_t *__restrict);
                                  ^
/Users/emurray/.nvm/versions/node/v7.7.3/lib/node_modules/webassembly/include/uchar.h:21:17: error: unknown type name 'char32_t'
size_t mbrtoc32(char32_t *__restrict, const char *__restrict, size_t, mbstate_t *__restrict);
                ^
4 errors generated.

I've also tried extern "C" the header with the same result (and it looks like you've externed all the header files anyway.)

I should also note that I'm very new to c, cpp and learning just to play with wasm so it's very likely that I've made a silly error.

install fail

Downloading binaries for darwin-x64 ...

/private/tmp/w/node_modules/webassembly/scripts/setup.js:64
throw err;
^

Error: no prebuilt binaries available for darwin-x64 (code 404)
at RedirectableRequest.https.get.res (/private/tmp/w/node_modules/webassembly/scripts/setup.js:21:22)

malloc vs memory.grow

Hi,
Awesome minimalist tool, all is working fine expect when I try to grow memory or use malloc.

  • When I use malloc it returns a pointer out of the buffer size.
  • When I use memory.grow I have detachedArray error on string conversion methods (executed when I uses console_log).

Do I have to grow memory at a specific time ?

I'm not a C expert maybe i'm doing something wrong. I working on mac and using npm lib using webpack to compile the final app.

Otherwise all's fine I did some test on matrix operation using a custom C port of gl-matrix I have a x10 execution speed with optimisation enabled. Performance is much less significant when I use math function (sin,cos) on matrix rotation), I have x1.3 exec speed.

Cheers,

Binaries for ARM

Any chance to add support for ARM?
I'm working on a Raspberry PI and this would really simplify my workflow.

fatal error: 'stdio.h' file not found

Hi all,

I am trying to compile a simple Hello World Script.

#include <stdio.h>

char * c_hello() {
   return "Hello World"; 
}

I can compile it fine using mbebenita.github.io/WasmExplorer but when I try to compile it using the following command

./node_modules/.bin/wa compile -o HelloWorld.wasm HelloWorld.c

I get the following error

$> ./node_modules/.bin/wa compile -o HelloWorld.wasm HelloWorld.c
Compiling on darwin-x64 ...

clang HelloWorld.c 
 -c 
 --target=wasm32-unknown-unknown 
 -emit-llvm 
 -nostdinc 
 -nostdlib 
 -D WEBASSEMBLY 
 -isystem /Users/anthonybudd/Development/WebAssembly_HelloWorld/node_modules/webassembly/include 
 -o /var/folders/vl/3fkjykn52zdb88cv3flv75zr0000gn/T/wa1_7474HSLCSC30dn9g.tmp

HelloWorld.c:1:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^~~~~~~~~
1 error generated.
FAILED Error: code 1
    at ChildProcess.<anonymous> (/Users/anthonybudd/Development/WebAssembly_HelloWorld/node_modules/webassembly/cli/util.js:38:24)
    at ChildProcess.emit (events.js:200:13)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)

FYI I know absolutely nothing about C. So apologies if this is a stupid question.

Leaks global variable WebAssembly

It seems that this module causes a global variable leak 'WebAssembly'.

Perhaps this is required or intentional, but it breaks leak detection for all dependent packages (chalk, for example).

If it's possible, it'd be best to stop 'WebAssembly' leaking, if this isn't possible then feel free to close this issue.

VS2017

Will this tool help me build a VS17 project? I don't really understand much of the documentation here. I am looking everywhere for a simple explanation of how to build a VS17 project with emscripten for webAssembly.

Exit status of wa-compile not properly propagating

  • OS: macOS sierra 10.12.6
  • package version: 0.11.0
  • executing command: wa compile -Oo output/dir/target.wasm source.c
  • output:
$ npm run wasm # wa compile -Oo priv/static/dist/fib.wasm fib.c

> [email protected] wasm /Users/yumatsuzawa/Workspace/yubot
> wa compile -Oo priv/static/dist/fib.wasm wasm/src/fib.c

Compiling on darwin-x64 ...

clang wasm/src/fib.c
 -O
 -c
 --target=wasm32-unknown-unknown
 -emit-llvm
 -nostdinc
 -nostdlib
 -D WEBASSEMBLY
 -isystem /Users/yumatsuzawa/Workspace/yubot/node_modules/webassembly/include
 -o /var/folders/f0/03jcty091k3684vmw5qr8yf00000gp/T/wa1_92739CYGeomA1qYDj.tmp

llvm-link /var/folders/f0/03jcty091k3684vmw5qr8yf00000gp/T/wa1_92739CYGeomA1qYDj.tmp /Users/yumatsuzawa/Workspace/yubot/node_modules/webassembly/lib/webassembly.bc
 -only-needed
 -o /var/folders/f0/03jcty091k3684vmw5qr8yf00000gp/T/wa2_92739T8s4xIqm7bBx.tmp

llc /var/folders/f0/03jcty091k3684vmw5qr8yf00000gp/T/wa2_92739T8s4xIqm7bBx.tmp
 -march=wasm32
 -filetype=asm
 -asm-verbose=false
 -thread-model=single
 -data-sections
 -function-sections
 -o /var/folders/f0/03jcty091k3684vmw5qr8yf00000gp/T/wa1_92739CYGeomA1qYDj.tmp

s2wasm /var/folders/f0/03jcty091k3684vmw5qr8yf00000gp/T/wa1_92739CYGeomA1qYDj.tmp
 --import-memory
 --allocate-stack 10000
 -o /var/folders/f0/03jcty091k3684vmw5qr8yf00000gp/T/wa2_92739T8s4xIqm7bBx.tmp

wasm-opt /var/folders/f0/03jcty091k3684vmw5qr8yf00000gp/T/wa2_92739T8s4xIqm7bBx.tmp
 -O3
 --coalesce-locals-learning
 --dce
 --duplicate-function-elimination
 --inlining
 --local-cse
 --merge-blocks
 --optimize-instructions
 --reorder-functions
 --reorder-locals
 --vacuum
 -o priv/static/dist/fib.wasm

Failed opening 'priv/static/dist/fib.wasm'
FAILED Error: code 1
    at ChildProcess.<anonymous> (/Users/yumatsuzawa/Workspace/yubot/node_modules/webassembly/cli/util.js:38:24)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

$ echo $status
0

In this case, priv/static/dist directory does not exist yet, so wasm-opt failing on file opening.
It exited with error code 1, though wa compile command itself is exiting with exit status 0 as shown above (I'm using fish-shell so echo $status equals to echo $? in bash).

How to force a standard for compilation?

What can I do if I need to force a standard to compile the c code to webassembly?
I'm trying to compile it with the C90 Ansi standard, and I have no clues about the one used by the compiler of this module

(node:91015) UnhandledPromiseRejectionWarning: TypeError: wasm function signature contains illegal type

As the description, the module provider runtime for WebAssembly modules.
I used AssemblyScript to compile the typescript file to wasm.

export function add(x: u64, y: u64): u64 {
  return x + y;
}

Then, using the webassembly to run the module,

require("webassembly")
  .load("main.wasm")
  .then(module => {
    console.log("1 + 2 = " + module.exports.add(1, 2));
  });

I got the error below

(node:92224) UnhandledPromiseRejectionWarning: TypeError: wasm function signature contains illegal type
    at require.load.then.module (/Users/Peng/Downloads/wasm-project-yolspucnghl/out/program.js:7:45)
(node:92224) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:92224) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Is there a gap between the AssemblyScript and webassembly?
And is there a node.js module to run the webassembly modules that AseemblyScript compiled.

DYNAMICPTR_TOP must be a number

After following your instructions in the README I get the following issue in Chrome 59:

src:211 Uncaught (in promise) LinkError: Import #0 module="env" function="DYNAMICTOP_PTR" error: global import must be a number at then.then.buffer (http://127.0.0.1:8080/node_modules/webassembly/dist/webassembly.js:212:37) at <anonymous>

However it works correctly in Firefox Nightly.

How to use malloc ?

I know that this project is inspired by emcsripten.

In emscripten, you can compile a c code that uses malloc, and you don't need to import it.

The malloc is defined in the .wasm, and you can export it.

Why can't I do something similar with this tool ?

I don't know how I'm suppose to export the malloc function !

Tools not working

I tried to use npm install webassembly and wa compile failed to compile. I then forked and cloned this repo and tried it and it takes the same way. After investigating I determined the pre-compiled tools isn't untaring properly and in linux-x64 only clang is there and it's not executable.

I then tired untaring manually and that worked but when I tried to execute clang it failed because of missing shared libraries. In the end I used a local version of wasm clang, binaryen, want tools that I'd created previously. And symlinked tools/bin/linux-x64 to my build, and that worked.

Weird Code Generation

I have a simple C file:

#include <webassembly.h>

export int contract_function(int bid) {
  return bid;
}

compiled with:

wa-compile --bare -o example.wasm example.c

Which generates:

(module
 (type $0 (func (param i32) (result i32)))
 (import "env" "memory" (memory $0 1))
 (table 0 anyfunc)
 (export "contract_function" (func $0))
 (func $0 (type $0) (param $var$0 i32) (result i32)
  (block $label$0 i32
   (i32.store offset=12
    (i32.sub
     (i32.load offset=4
      (i32.const 0)
     )
     (i32.const 16)
    )
    (get_local $var$0)
   )
   (get_local $var$0)
  )
 )
)

This generates a memory RuntimeError: memory access out of bounds when I try to load it.

However, when I compile using wasmfiddle I get:

(module
 (table 0 anyfunc)
 (memory $0 1)
 (export "memory" (memory $0))
 (export "contract_function" (func $contract_function))
 (func $contract_function (; 0 ;) (param $0 i32) (result i32)
  (get_local $0)
 )
)

Any ideas?

How to install in Docker?

Hi, I can install packages with npm most of the time, but when I run npm install -g webassembly in a Docker container from library/debian:buster, then I get an error at the end of the installation:

# npm install -g webassembly
npm WARN npm npm does not support Node.js v10.15.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN deprecated [email protected]: ⚠️  WARNING ⚠️ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar
/usr/local/bin/wa -> /usr/local/lib/node_modules/webassembly/bin/wa
/usr/local/bin/wa-compile -> /usr/local/lib/node_modules/webassembly/bin/wa-compile
/usr/local/bin/wa-assemble -> /usr/local/lib/node_modules/webassembly/bin/wa-assemble
/usr/local/bin/wa-disassemble -> /usr/local/lib/node_modules/webassembly/bin/wa-disassemble

> [email protected] postinstall /usr/local/lib/node_modules/webassembly
> node scripts/setup

fs.js:115
    throw err;
    ^

Error: EACCES: permission denied, open '/usr/local/lib/node_modules/webassembly/wa-tools-3287gDj9vAX5jff0.tmp'
    at Object.openSync (fs.js:439:3)
    at Object._createTmpFileSync [as fileSync] (/usr/local/lib/node_modules/webassembly/node_modules/tmp/lib/tmp.js:266:15)
    at Object.<anonymous> (/usr/local/lib/node_modules/webassembly/scripts/setup.js:18:16)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/setup`
npm ERR! Exit status 1

Any tips for resolution?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.