node安装phantomjs失败

我按照npm的安装方式进行安装,安装过程:

 npm install phantomjs-prebuilt 

> phantomjs-prebuilt@2.1.15 install /data/wwwroot/qrcode/node_modules/phantomjs-prebuilt
> node install.js

PhantomJS not found on PATH
Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /data/wwwroot/qrcode/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1505540093865/phantomjs-2.1.1-linux-x86_64 -> /data/wwwroot/qrcode/node_modules/phantomjs-prebuilt/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /data/wwwroot/qrcode/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
npm WARN qrcode@1.0.0 No description
npm WARN qrcode@1.0.0 No repository field.

+ phantomjs-prebuilt@2.1.15
updated 1 package in 28.151s
[root@VM_171_198_centos qrcode]# phantomjs --version
bash: /usr/local/bin/phantomjs: No such file or directory

请问怎么解决这个问题?
已经纠结了一天,starkoverflow上面的也看了试了,解决不了。

wwwroot文件夹的权限是777

阅读 8.8k
2 个回答
cd /data/wwwroot/qrcode
./node_modules/.bin/phantomjs --version

你又没有安装到全局,直接输入phantomjs 肯定是不可能成功的。

总结一下几个问题:

  1. phantomjs已经宣布不再维护,不建议使用了
  2. 你可以不需要这么安装,非常慢,建议直接下载官方编译好的版本,将可执行程序放到/usr/local/bin/即可。官方编译好的版本在s3上,被墙了,国内有镜像: https://npm.taobao.org/mirror...

最后你的问题是没用npm i -g安装到全局目录

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进