質問するログイン新規登録

Q&A

解決済

1回答

2255閲覧

[mac] brackets"JSONエラー”の解消方法について

kodakku

総合スコア1

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

Brackets

Bracketsは、オープンソースで開発されているHTML/CSS/JavaScriptのコードエディターです。

0グッド

0クリップ

投稿2022/02/15 14:04

編集2022/02/16 01:53

0

0

###実現したいこと
Bracketsを開いた際に、以下のエラーが出ます。このエラーを解消したい。

環境設定ファイルが有効なJSONではありません。ファイルが開かれます。フォーマットを修正してください。変更を反映するにはbracketsを再起動させる必要があります。

###試したこと
JSONエラーチェックにかけたら、元々あったコードにエラー返ってきます。
追加したコードにはエラーはありませんでした。

<追加したコード>

"php" : { "executablePath": "/Applications/MAMP/bin/php/php7.4.21/bin/php" }

<エラーチェックにかけたコード>

{ "brackets-eslint.gutterMarks": true, "brackets-eslint.useLocalESLint": false, "fonts.fontSize": "12px", "fonts.fontFamily": "'SourceCodePro-Medium', MS ゴシック, 'MS Gothic', monospace", "php" : { "executablePath": "/Applications/MAMP/bin/php/php7.4.21/bin/php" } "themes.theme": "dark-theme", "edc.brackets-snippets.hints": [ { "trigger": "cl", "scope": "javascript", "description": "console.log", "tag": "VanillaJS", "tagHide": true, "text": "console.log(${1:obj});${2}", "source": "system" }, { "trigger": "cd", "scope": "javascript", "description": "console.dir", "tag": "VanillaJS", "tagHide": true, "text": "console.dir(${1:obj});${2}", "source": "system" }, { "trigger": "ce", "scope": "javascript", "description": "console.error", "tag": "VanillaJS", "tagHide": true, "text": "console.error(${1:obj});${2}", "source": "system" }, { "trigger": "cll", "scope": "javascript", "description": "console.log", "tag": "VanillaJS", "tagHide": true, "text": "console.log('${1:obj}:', ${1:obj});${2}", "source": "system" }, { "trigger": "cdd", "scope": "javascript", "description": "console.dir", "tag": "VanillaJS", "tagHide": true, "text": "console.dir('${1:obj}:', ${1:obj});${2}", "source": "system" }, { "trigger": "cee", "scope": "javascript", "description": "console.error", "tag": "VanillaJS", "tagHide": true, "text": "console.error('${1:obj}:', ${1:obj});${2}", "source": "system" }, { "trigger": "ae", "scope": "javascript", "description": "document.addEventListener", "tag": "VanillaJS", "tagHide": true, "text": "${1:document}.addEventListener('${2:event}', function(e) {\n ${3}\n});", "source": "system" }, { "trigger": "ac", "scope": "javascript", "description": "document.appendChild", "tag": "VanillaJS", "tagHide": true, "text": "${1:document}.appendChild(${2:elem});${3}", "source": "system" }, { "trigger": "rc", "scope": "javascript", "description": "document.removeChild", "tag": "VanillaJS", "tagHide": true, "text": "${1:document}.removeChild(${2:elem});${3}", "source": "system" }, { "trigger": "cel", "scope": "javascript", "description": "document.createElement", "tag": "VanillaJS", "tagHide": true, "text": "${1:document}.createElement(${2:elem});${3}", "source": "system" }, { "trigger": "gi", "scope": "javascript", "description": "document.getElementById", "tag": "VanillaJS", "tagHide": true, "text": "${1:document}.getElementById('${2:id}');${3}", "source": "system" }, { "trigger": "gc", "scope": "javascript", "description": "document.getElementsByClassName", "tag": "VanillaJS", "tagHide": true, "text": "${1:document}.getElementsByClassName('${2:class}');${3}", "source": "system" }, { "trigger": "gt", "scope": "javascript", "description": "document.getElementsByTagName", "tag": "VanillaJS", "tagHide": true, "text": "${1:document}.getElementsByTagName('${2:tag}');${3}", "source": "system" }, { "trigger": "qs", "scope": "javascript", "description": "document.querySelector", "tag": "VanillaJS", "tagHide": true, "text": "${1:document}.querySelector('${2:selector}');${3}", "source": "system" }, { "trigger": "qsa", "scope": "javascript", "description": "document.querySelectorAll", "tag": "VanillaJS", "tagHide": true, "text": "${1:document}.querySelectorAll('${2:selector}');${3}", "source": "system" }, { "trigger": "fe", "scope": "javascript", "description": "forEach", "tag": "VanillaJS", "tagHide": true, "text": "${1:myArray}.forEach(function (${2:elem}) {\n ${3}\n});", "source": "system" }, { "trigger": "fi", "scope": "javascript", "description": "for in", "tag": "VanillaJS", "tagHide": true, "text": "for (${1:prop} in ${2:obj}) {\n if (${2:obj}.hasOwnProperty(${1:prop})) {\n ${3}\n }\n}", "source": "system" }, { "trigger": "fn", "scope": "javascript", "description": "function", "tag": "VanillaJS", "tagHide": true, "text": "function ${1:methodName} (${2:arguments}) {\n ${3}\n}", "source": "system" }, { "trigger": "afn", "scope": "javascript", "description": "anonymous function", "tag": "VanillaJS", "tagHide": true, "text": "function (${1:arguments}) {\n ${2}\n}", "source": "system" }, { "trigger": "pr", "scope": "javascript", "description": "prototype", "tag": "VanillaJS", "tagHide": true, "text": "${1:ClassName}.prototype.${2:methodName} = function (${3:arguments}) {\n ${4}\n};", "source": "system" }, { "trigger": "sw", "scope": "javascript", "description": "switch statement", "tag": "VanillaJS", "tagHide": true, "text": "switch(${1:expression}) {\n case ${2:value}:\n ${3}\n break;\n default:\n break;\n}", "source": "system" }, { "trigger": "si", "scope": "javascript", "description": "setInterval", "tag": "VanillaJS", "tagHide": true, "text": "setInterval(function() {\n ${2}\n}, ${1:delay});", "source": "system" }, { "trigger": "st", "scope": "javascript", "description": "setTimeout", "tag": "VanillaJS", "tagHide": true, "text": "setTimeout(function() {\n ${2}\n}, ${1:delay});", "source": "system" }, { "trigger": "for", "scope": "php", "description": "for", "text": "for ($i = ${1:init}; $i < ${2:length}; $i++)\n{\n ${3}\n}", "source": "system" }, { "trigger": "if", "scope": "php", "description": "if", "text": "if (${1:condition})\n{\n ${2}\n}", "source": "system" }, { "trigger": "ifelse", "scope": "php", "description": "if else", "text": "if (${1:condition})\n{\n ${2}\n}\nelse\n{\n ${3}\n}", "source": "system" } ], "bb.beautify.onSave": false, "custom.work.useIconsOfCustomWork": true, "custom.work.blueish": true, "custom.work.moveToolbarToSidebar": true, "custom.work.autoHideTheTabmenu": true, "custom.work.halfcircle.sidebar": true, "denniskehrig.ShowWhitespace.checked": true, "externalApplications": { "jpg": "Preview", "jpeg": "Preview", "png": "Preview", "svg": "Brackets", "psd": "Adobe Photoshop CC 2019", "ai": "Adobe Photoshop CC 2019" } }

<返ってきたエラー>

Error: Parse error on line 9: ...php" } "themes.theme": "dar --------------------^ Expecting 'EOF', '}', ',', ']', got 'STRING'

また、phpのパスを通す際に、ターミナルでこのようにしてphpのパスを通しました。

$ export PATH=/Applications/MAMP/bin/php/php7.4.21/bin:$PATH

しかし、最初は通っていたpathがmampを閉じたら? which phpやphp -vとしても何も返ってこなくなりました。なぜなのでしょうか...

昨日から色々調べて試しているのですが、上手くいかず先に進めません。

どうかご教授ください。よろしくお願いします。

###補足情報
実施環境: OS:macOS Monterey Ver 12.1

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

guest

回答1

0

ベストアンサー

提示されたのが一部で画像なので手元で再現できませんが、見える範囲だとJSONの文法の問題です。
グループ内最後の要素に,をつけてはいけません。
JSON文法チェック(ネット上にもあります)にもかけてみてください。

投稿2022/02/15 21:22

m.ts10806

総合スコア80896

kodakku

2022/02/15 23:48

回答ありがとうございます。 JSON文法チェックにかけたところ下記のようなエラーが出ました。 Error: Parse error on line 1: "php":{ "executab -----^ Expecting 'EOF', '}', ',', ']', got ':' また、コマンドでwhich php としたところ何も表示されませんでした。 昨日はパスが表示されたのですが、mampを止めると削除されるのでしょうか。 どうかご教授下さい。よろしくお願いします。
m.ts10806

2022/02/15 23:50

回答に書いた下記は理解されてますか? >グループ内最後の要素に,をつけてはいけません。
kodakku

2022/02/15 23:54

理解しました。,を削除しJSON文法にかけました。 回答ありがとうございます。
kodakku

2022/02/15 23:58

画像を追加しましたのでご確認ください。
m.ts10806

2022/02/16 00:37

構文チェックは一部ではなく全部をかけないと意味がないかと。 JSONも画像ではこちらで確認できませんので、テキストでマークダウンにてご提示ください
kodakku

2022/02/16 01:13

すみません、画像では確認できないのですね。 質問文を変更しましたので、ご確認ください。 全部の構文をチェックしたら、元々あったコードにエラーが出て、追加したコードにはエラーが出ませんでした。 さらに混乱に陥ってしまいました。 どうか、ご教授下さい。よろしくお願いします。
m.ts10806

2022/02/16 01:30

「最後の要素にはつけてはいけない」 のがルールですが、「最後でなければつけないといけない(次にも要素があるから)」です。 "php" : { "executablePath": "/Applications/MAMP/bin/php/php7.4.21/bin/php" } ←次の要素があるのでここには必要。
kodakku

2022/02/16 01:42

"php" : { "executablePath": "/Applications/MAMP/bin/php/php7.4.21/bin/php" } このように記述しましたがエラーは解消されませんでした。 質問にも追加して書いたのですが、pathの通し方には問題はないでしょうか。 よろしくお願いします。
m.ts10806

2022/02/16 02:07

あのですから、「カンマ」が必要かどうかの話でして。 "php" : { "executablePath": "/Applications/MAMP/bin/php/php7.4.21/bin/php" } ,
kodakku

2022/02/16 02:33

解決しました!! ありがとうございます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.29%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問