5
4

More than 5 years have passed since last update.

node.js で Phantom を使えるようにするまでの準備

Posted at

node.js で Phantom をインストールして使えるようにするまでの準備作業を残しておきます。

インターネットにある半年前の情報では、

> npm init
> npm install --save phantom phantomjs

という手順で、関連するモジュールをインストールするように説明されています。
しかし、

npm WARN deprecated phantomjs@2.1.7: Package renamed to phantomjs-prebuilt. Please update 'phantomjs' package references to 'phantomjs-prebuilt'
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead

という警告が表示されます。

phantomjs-prebuilt をインストールする

npm WARN deprecated phantomjs@2.1.7: Package renamed to phantomjs-prebuilt. Please update 'phantomjs' package references to 'phantomjs-prebuilt'

はモジュール名が変更されたので、phantomjs-prebuilt をインストールするように書かれています。ですので、

> npm uninstall --save phantomjs
> npm install --save phantomjs-prebuilt

と実行して、phantomjs-prebuilt をインストールします。

tough-cookie をアップデートする

次に、

npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130

は、tough-cookie@2.2.2 に脆弱性という警告で、参照先の URL を確認します。

バージョン 2.3.0 以上にアップデートするように記載されているので、実行します。

> npm install --save tough-cookie

+ tough-cookie@2.3.4
updated 1 package in 0.969s

uuid をインストールする

最後に

npm WARN deprecated node-uuid@1.4.8: Use uuid module instead

は node-uuid は非推奨なので、uuid というモジュールを使うように警告が出ているので、こちらも対応します。

> npm uninstall --save node-uuid
> npm install --save uuid

現時点で PhantomJS をインストールするには

> npm install --save phantom phantomjs-prebuilt tough-cookie uuid

を実行することになります。

5
4
1

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
5
4