Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhantomJS not found on PATH #11

Open
xhlwill opened this issue Mar 22, 2017 · 4 comments
Open

PhantomJS not found on PATH #11

xhlwill opened this issue Mar 22, 2017 · 4 comments

Comments

@xhlwill
Copy link
Owner

xhlwill commented Mar 22, 2017

今天安装包时碰到问题:

> phantomjs-prebuilt@2.1.14 install /Users/will/work/my-project/node_modules/phantomjs-prebuilt
> node install.js

PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-macosx.zip
Saving to /var/folders/mh/2ptfthxj2qb49jscj1b0gjsm0000gn/T/phantomjs/phantomjs-2.1.1-macosx.zip
Receiving...

Error making request.
Error: connect ETIMEDOUT 54.231.113.227:443
    at Object.exports._errnoException (util.js:1018:11)
    at exports._exceptionWithHostPort (util.js:1041:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)

后来发现是天朝网络的原因:它的安装过程中要去 github 下载一个包,而 github release 文件放在亚马逊 aws 上(被墙了)。解决方法是借助淘宝镜像 (http://cnpmjs.org/downloads https://npm.taobao.org/mirrors/phantomjs/) 安装,输入以下命令:

PHANTOMJS_CDNURL=https://npm.taobao.org/mirrors/phantomjs npm install phantomjs-prebuilt

phantomjs 已改名为 phantomjs-prebuilt https://github.com/Medium/phantomjs#versioning
image

同样安装 node-sass 也会出现类似的问题,解决方法依然是淘宝镜像:

SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass npm install node-sass

Tips:
如果不想每次都输入前面变量可以将它们写入 ~/.npmrc 文件中😄(https://docs.npmjs.com/files/npmrc)

sass_binary_site = https://npm.taobao.org/mirrors/node-sass
phantomjs_cdnurl = https://npm.taobao.org/mirrors/phantomjs
registry = https://registry.npm.taobao.org
@xhlwill xhlwill added the node label Mar 22, 2017
@xhlwill xhlwill changed the title PhantomJS not found on PATH PhantomJS not found on PATH [phantomjs-prebuilt] Apr 20, 2017
@xhlwill
Copy link
Owner Author

xhlwill commented Apr 24, 2017

@CracKerMe
Copy link

我的Mac在全局安装elf-cli的时候, 开了翻墙 还是各种安装不了,因为这个PhantomJS 只是这个架手架的某个依赖,最终还是 使用cnpm 全局安装了

@ghost
Copy link

ghost commented Aug 16, 2019

但是我想安装特定版本的时候,就会出现

npm ERR! notarget No matching version found for phantomjs-prebuilt@1.9.7-1
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget 
npm ERR! notarget It was specified as a dependency of '4821bed2284b9b922abc8495e4b540c30143ce30-362d2a0-c6bbe17'
npm ERR! notarget 

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-08-16T09_27_38_126Z-debug.log

@xhlwill
Copy link
Owner Author

xhlwill commented Aug 16, 2019

看提示应该是这个1.9.7-1版本不存在,npmjs.com也搜不到@11510746

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants