Ubuntu 17.10にphantomjsをインストールしてみる
Ubuntu17.10にphantomjsをインストールしてみる
ググると色々あるんだけど、
install phantomjs 2.1.1 - ubuntu
Build
パッケージもそう古くはなさそうなのでそのまま使ってみる
$ sudo apt-get install phantomjs
$ phantomjs -v
2.1.1
hello.js
"use strict";
console.log('Hello, world!');
phantom.exit();
$ phantomjs hello,js
Hello, world!
Doesn't work in VSC 1.11.1 on Mac
Debugger for PhantomJS
vscodeでDebugger for PhantomJSを試してみる
・拡張機能より
Debugger for PhantomJS をインストールする
Code Runner をインストールする
・フォルダを作成する
・フォルダをひらく
->CTRL+SHIFT+D(デバッグボタン)
->launch.jsonの構成や修正を押下して phantomjs を選択する
※*.jsファイルが存在すると表示されない
・launch.json に最下2行を追加する
Code Runnerの設定
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "phantomjs",
"request": "launch",
"file": "${workspaceRoot}/test.js",
"webRoot": "${workspaceRoot}",
"runtimeExecutable": "/usr/bin/phantomjs",
"runtimeArgs": [],
"scriptArgs": [],
"sourceMaps": true,
"verboseDiagnosticLogging": true,
"diagnosticLogging": true
}
]
・ファイル
-> 基本設定
-> 設定
-> ワークスペースの設定
以下のコード記述して右クリック->Run Codeで実行して、正常動作を確認
"code-runner.executorMap": {
"javascript": "phantomjs",
}
"use strict";
console.log('Hello, world!');
phantom.exit();