Best way to get spidermonkey js on Ubuntu?

前端 未结 5 1109
小鲜肉
小鲜肉 2020-12-30 04:15

I need to install the Spidermonkey JS engine on my work machine. The project I\'m working on has a jslint script that requires Spidermonkey or a similar js binary. I\'ve tri

5条回答
  •  抹茶落季
    2020-12-30 04:30

    Also, (via #2: spidermonkey-bin not availble in Ubuntu Lucid - Issues - hallettj/jslint.vim - GitHub), can use PPA for Launchpad Engineering : “Canonical Launchpad Engineering” team:

    sudo add-apt-repository ppa:launchpad/ppa
    sudo apt-get update
    sudo apt-get install spidermonkey-bin
    apt-cache show spidermonkey-bin
    sudo apt-get install spidermonkey-bin # also installs extra: libmozjs2d
    
    # .. and then: 
    $ js --help
    JavaScript-C 1.8.0 pre-release 1 2007-10-03
    usage: js [-zKPswWxCij] [-t timeoutSeconds] [-c stackchunksize] [-o option] [-v version] [-f scriptfile] [-e script] [-S maxstacksize] [scriptfile] [scriptarg...]
    $ js
    js> var f = function(){ print("the answer is " + 42); }; 
    js> f();
    the answer is 42
    js> ^C
    $
    

提交回复
热议问题