foliojs / brotli.js

A JavaScript port of the Brotli compression algorithm, as used in WOFF2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: Cannot read property 'replace' of undefined

moyogo opened this issue · comments

> var brotli = require('brotli');
/usr/local/lib/node_modules/brotli/build/all.js:2
a,n)};u.load=function(a){ka(read(a))};u.thisProgram=process.argv[1].replace(/\
                                                                    ^
TypeError: Cannot read property 'replace' of undefined
    at Object.<anonymous> (/usr/local/lib/node_modules/brotli/build/all.js:2:461)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/brotli/index.js:1:76)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

This only happens if a script is used without arguments.

This also happens with require('brotli') at least on node 4.1.0

Only happens in the REPL. Emscripten tries to look for the name of the program, which would normally be the first argument to node, but with the REPL there is no argument.