前提・実現したいこと
MAC版Visual Studio Codeで、プラグインW3C Validation(https://marketplace.visualstudio.com/items?itemName=Umoxfo.vscode-w3cvalidation)を使いたいのですが、
以下のエラーメッセージが出て、バリデーションが走りません。
OUTPUTに出るエラーメッセージが怪しそうなのですが、知識不足でわからないので修正箇所をご教示いただけると幸いです。
発生している問題・エラーメッセージ
W3Cのプラグインをenableにした瞬間下記のエラーが出ます。
The HTML Validation Service server crashed 5 times in the last 3 minutes. The server will not be restarted.
OUTPUTを見ると下記のメッセージが出ています。
SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at IncomingMessage.response.on (/Users/username/.vscode/extensions/umoxfo.vscode-w3cvalidation-2.3.2/server/out/validator.js:43:51) at IncomingMessage.emit (events.js:187:15) at endReadableNT (_stream_readable.js:1092:12) at process._tickCallback (internal/process/next_tick.js:63:19) [Error - 6:38:27 PM] Connection to server got closed. Server will not be restarted.
試したこと
SyntaxError: Unexpected token < in JSON at position 0 でググりましたが、よくわかりませんでした。。。 構文エラーで使ってはいけない場所で"<"が使われているよ、と言っていることまではわかりましたが、自身の環境でどこを直すのか、がわかりませんでした。(インストールしただけで特に何も触っていません。
validator.js:43:51を見てみましたが、修正ポイントを見つけられませんでした。
該当のソースコード
/* * Copyright (c) Makoto Sakaguchi. All rights reserved. * Licensed under the MIT License. See LICENSE in the project root for license information. */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const http = require("http"); const RequestOptions = { hostname: "localhost", port: 8888, path: "/?out=json", method: "POST", headers: { "User-Agent": "Validator.nu/LV", }, }; const MediaTypes = { html: "text/html", css: "text/css", svg: "image/svg+xml", }; function setContentType(languageId) { RequestOptions.headers["Content-Type"] = `${MediaTypes[languageId]}; charset=utf-8`; } // setContentType /* * Sends document to the local validation server */ function sendDocument(document) { return new Promise((resolve, reject) => { // Set the request headers setContentType(document.languageId); const request = http.request(RequestOptions, (response) => { // handle http errors if (response.statusCode < 200 || response.statusCode > 299) { reject(); } // temporary data holder response.setEncoding("utf8"); let body = ""; // on every content chunk, push it to the data array response.on("data", (chunk) => body += chunk); // we are done, resolve promise with those joined chunks response.on("end", () => resolve(JSON.parse(body).messages)); }); // handle connection errors of the request request.on("error", (err) => reject(err)); // write data to request body request.write(document.getText()); request.end(); }); } // sendDocument exports.sendDocument = sendDocument; //# sourceMappingURL=validator.js.map
補足情報(FW/ツールのバージョンなど)
Visual Studio Code [Mac]
バージョン1.36.1
設定のJRE pathは通していません。空白のままです。過去にJREのパスを調べて通しましたが、引き続きエラーが出ていたことと、知人のMacではパスを通さず動いていたため。
あなたの回答
tips
プレビュー