How to update phantomjs 1.9.8 to phantomjs 2.1.1 on ubuntu?

后端 未结 6 869
北恋
北恋 2021-02-02 16:54

I cant reinstall phantomjs 1.9.8 to 2.1.1 version on my ubuntu 16.04 Please help. 1.9.8 give me an errors when I write a spin functions, in documentation see that this ploblem

6条回答
  •  佛祖请我去吃肉
    2021-02-02 17:49

    For those who have problems to install like me

    it is more easy than you think...

    • I uninstall phantomjs: Remove phantomjs from ubuntu sudo apt-get remove phantomjs or remove npm folder of /node_modules/phantomjs it will be in /, maybe you will need to remove ln the link of phantomjs in /usr/bin or /usr/local/bin/ the name of it is phantomjs

    Example

    //use this if you installed with apt-get
    sudo apt-get remove phantomjs    *remove the phantomjs
    rm /usr/bin/phantomjs            *use this if the link didn't remove.
    
    //use this if you installed from npm: like this: npm install phantomjs
    rm -R /node_modules/phantomjs    *note: it will be in other folder, search it.
    
    • install phantomjs from npm: npm install phantomjs from / directory, npm install it in folder /node_module/phantomjs

    Example

    cd /;
    npm install phantomjs
    
    • Test bin file

    Example

    //check version of phantomjs
    /node_modules/phantomjs/bin/phantomjs -v
    /node_modules/phantomjs/bin/phantomjs test.js
    
    • link file bin to /usr/bin:

    Example

    ln -sf /node_modules/phantomjs/bin/phantomjs /usr/bin/phantomjs

    • check version of it to see if it's ok
      phantomjs -v in my case 2.1.1

提交回复
热议问题