Nuxt.js+microCMSで生成した記事の更新・削除時と、リポジトリ内の別ファイルを更新したときのどれかを行ったとき、Netlifyに自動ビルドしたい
解決したいこと
Nuxt.js+microCMSで生成した記事の更新・削除時と、リポジトリ内の別ファイルを更新したときのどれかを行ったとき、Netlifyに自動ビルドしたい。
例)
元々自前のHTML,CSS,JavaScriptで静的なWEBサイトをNetlify経由で公開していました。
このサイトにNewsページを追加するにあたってヘッドレスCMSを用いたら効率的ではないかと思い、Nuxt.js+microCMSの公式ドキュメントに行き着きました。
諸々のセッティングは上手くいっていたのですが、ファイルのホスティングというのでしょうか、自動ビルドの設定をどうしたら良いか分からず、色々検索して出たものを試してみましたが解決できませんでした。
発生している問題・エラー
12:42:28 AM: ────────────────────────────────────────────────────────────────
12:42:28 AM: 1. Build command from Netlify app
12:42:28 AM: ────────────────────────────────────────────────────────────────
12:42:28 AM:
12:42:28 AM: $ npm run generate
12:42:29 AM: npm ERR! Missing script: "generate"
12:42:29 AM: npm ERR!
12:42:29 AM: npm ERR! To see a list of scripts, run:
12:42:29 AM: npm ERR! npm run
12:42:29 AM: npm ERR! A complete log of this run can be found in:
12:42:29 AM: npm ERR! /opt/buildhome/.npm/_logs/2022-01-10T15_42_29_166Z-debug.log
12:42:29 AM:
12:42:29 AM: ────────────────────────────────────────────────────────────────
12:42:29 AM: "build.command" failed
12:42:29 AM: ────────────────────────────────────────────────────────────────
12:42:29 AM:
12:42:29 AM: Error message
12:42:29 AM: Command failed with exit code 1: npm run generate
12:42:29 AM:
12:42:29 AM: Error location
12:42:29 AM: In Build command from Netlify app:
12:42:29 AM: npm run generate
12:42:29 AM:
12:42:29 AM: Resolved config
12:42:29 AM: build:
12:42:29 AM: command: npm run generate
12:42:29 AM: commandOrigin: ui
12:42:29 AM: environment:
12:42:29 AM: - CI
12:42:29 AM: - INCOMING_HOOK_BODY
12:42:29 AM: - INCOMING_HOOK_TITLE
12:42:29 AM: - INCOMING_HOOK_URL
12:42:29 AM: - NODE_VERSION
12:42:29 AM: publish: /opt/build/repo/dist
12:42:29 AM: publishOrigin: ui
12:42:29 AM: Caching artifacts
12:42:29 AM: Started saving node modules
12:42:29 AM: Finished saving node modules
12:42:29 AM: Started saving build plugins
12:42:29 AM: Finished saving build plugins
12:42:29 AM: Started saving pip cache
12:42:29 AM: Finished saving pip cache
12:42:29 AM: Started saving emacs cask dependencies
12:42:29 AM: Finished saving emacs cask dependencies
12:42:29 AM: Started saving maven dependencies
12:42:29 AM: Finished saving maven dependencies
12:42:29 AM: Started saving boot dependencies
12:42:29 AM: Finished saving boot dependencies
12:42:29 AM: Started saving rust rustup cache
12:42:29 AM: Finished saving rust rustup cache
12:42:29 AM: Started saving go dependencies
12:42:29 AM: Finished saving go dependencies
12:42:31 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:42:31 AM: Creating deploy upload records
12:42:31 AM: Failing build: Failed to build site
12:42:31 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
12:42:31 AM: Finished processing build request in 18.437273402s
該当するソースコード
自分で試したこと
公式ドキュメント、その他の資料のことを試しました。
例
https://blog.microcms.io/microcms-nuxt-jamstack-blog/
https://qiita.com/sakapun/items/25d96f1ce1d76eeda603
https://teratail.com/questions/181411
https://github.com/nuxt/create-nuxt-app/issues/560
WEBサイト開発自体が初学者のため、具体的な仕組みがよく分かっていない可能性もあります。
今回のようにWEBコンテンツの一部にNuxt.jsを用いた例を検索しても上手く出てこず、途方に暮れています。
フォルダの構成は
A――――index.html
|-- about -- character -- index.html
|-- news -- nuxt.js色々
|-- dist -- (ランダム生成の名前) --index.html
となっています。
他不足した情報がありましたらお手数ですがご教示くださいませ。
何卒宜しくお願い致します。