LoginSignup
1

More than 5 years have passed since last update.

node0.12.7 で casperjs@1.1.0-beta3 をnpmにて正しくインストールする方法(Mac + nodebrew)

Last updated at Posted at 2015-07-11

0.11.160.12.7 でインストール時の挙動が違ったのでメモ。

結論

  1. npm i -g casperjs@1.1.0-beta3
  2. echo 'PHANTOMJS_EXECUTABLE=$HOME/.nodebrew/current/lib/node_modules/casperjs/node_modules/phantomjs/bin/phantomjs' >> ~/.bash_profile
  3. source ~/.bash_profile

詳細

0.12.7の場合、そもそもインストール出来ない

npm ERR! notarget No compatible version found: casperjs@'*'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["1.1.0-beta2","1.1.0-beta3"]
npm ERR! notarget
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

↑のERRORにしたがって

$ npm i -g casperjs@1.1.0-beta3

とするとインストール可能。(v0.11.16ではバージョン指定は不要だった)

しかしこれだけだと、 $ casperjs で以下のERRORを吐く。

Fatal: [Errno 2] No such file or directory; did you install phantomjs?

phantomjsのpathを見つけられていないようなので追加。

.bash_profile
PHANTOMJS_EXECUTABLE=$HOME/.nodebrew/current/lib/node_modules/casperjs/node_modules/phantomjs/bin/phantomjs

これでnodebrew環境でも動いた。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1