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
phantomjs 2.1.1 is now currently bundled with 16.04 (https://launchpad.net/ubuntu/xenial/+source/phantomjs), so you should be able to install/upgrade it as a system package.
Update: This answer exists for informative purposes, but it is not recommended to use the system package version now due to issues such as: https://bugs.launchpad.net/ubuntu/+source/phantomjs/+bug/1605628 This is related to an issue with file upload that was fixed upstream, but the nature of the fix prevented it from working as a system package.
The best current option is use the prebuilt binary from: https://bitbucket.org/ariya/phantomjs/download