install phantomjs / any package globally specific version

时间:2016-10-20 18:55:56

标签: npm phantomjs npm-install

I want to globally install phantomjs version 1.9.8 globally.

When I ran phantomjs --version it showed me 2.1.1

So I ran npm uninstall phantomjs -g which was successfull.

Next when I try to run npm install phantomjs -g 1.9.8 it is throwing me the below error

> npm WARN deprecated phantomjs@2.1.7: Package renamed to
> phantomjs-prebuilt. Please update 'phantomjs' package references to
> 'phantomjs-prebuilt' npm ERR! Darwin 14.5.0 npm ERR! argv
> "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "phantomjs"
> "1.9.20" npm ERR! node v4.4.7 npm ERR! npm  v2.15.8 npm ERR! code E404
> 
> npm ERR! 404 Registry returned 404 for GET on
> https://registry.npmjs.org/1.9.20 npm ERR! 404  npm ERR! 404 '1.9.20'
> is not in the npm registry. npm ERR! 404 You should bug the author to
> publish it (or use the name yourself!) npm ERR! 404  npm ERR! 404 Note
> that you can also install from a npm ERR! 404 tarball, folder, http
> url, or git url.
> 
> npm ERR! Please include the following file with any support request:
> npm ERR!     /work/development/test-folder/npm-debug.log

How could I install a required version of pantomjs globally.

PS : I am not using homebrew and would like to avoid using homebrew

1 个答案:

答案 0 :(得分:1)

阅读npm api docs后,我找到了解决方案。

npm install -g phantomjs@version

一般来说,

npm install -g packageName@version

如果您没有权限,请

使用sudo访问权限。

  

这甚至可以全局降级包