5t3ph / 5t3ph/eleventy-plugin-social-images

JSON error

オープン 初心者向け
#4 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
52
フォーク
9
PR マージ指標
30日以内にマージされた PR はありません

説明

when running with documented config:

```
lgwapnitsky@blog:~/lgw_11ty$ eleventy-social-images --site-name "Larry G. Wapnitsky"
Starting social images...
(node:18860) UnhandledPromiseRejectionWarning: SyntaxError: /home/lgwapnitsky/lgw_11ty/pages.json: Unexpected number in JSON at position 1
at parse ()
at Object.Module._extensions..json (internal/modules/cjs/loader.js:1106:22)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at /home/lgwapnitsky/lgw_11ty/node_modules/@11tyrocks/eleventy-plugin-social-images/bin/social-images.js:82:17
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:18860) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:18860) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

```

pages.json file:

```
---
permalink: ./pages.json
permalinkBypassOutputDir: true
eleventyExcludeFromCollections: true
---
[
{%- for pages in collections.all %}
{
"title":"{{ pages.data.title | addNbsp | safe }}",
"imgName":"{{ pages.data.title | slug }}"
}{% if loop.last == false %},{% endif -%}
{% endfor %}
]
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

The error occurs in bin/social-images.js at line 82 when trying to parse pages.json. First, examine the JSON generation in the Eleventy template to ensure it outputs valid JSON. Then, check the parsing logic in the plugin to see if it handles the file correctly. Running the command with the provided config and inspecting the generated pages.json file will help identify the syntax issue.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, json, node.js
領域
tooling
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
65/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。