こんにちは、今日は kintoneプラグイン開発 に初挑戦して、秒でつまずいた話を共有します。未来の自分と同じようにハマりそうな人のために、ログを残しておきます。
参考にした記事: kintone プラグインを最速で作る手順(自己メモ)
💻 開発環境
- OS: Windows 11
- Node.js: v20.17.0
🛠 プロジェクト作成
npx @kintone/create-plugin empty-plugin
kintoneプラグインのプロジェクトを作成するために、いくつかの質問に答えてください :)
では、はじめましょう!
? プラグインの英語名を入力してください [1-64文字] empty-plugin
? プラグインの説明を入力してください [1-200文字] empty-plugin
? 日本語をサポートしますか? yes
? プラグインの日本語名を入力してください [1-64文字] (省略可)
? プラグインの日本語の説明を入力してください [1-200文字] (省略可)
? 中国語をサポートしますか? no
? スペイン語をサポートしますか? no
? プラグインの英語のWebサイトURLを入力してください (省略可)
? プラグインの日本語のWebサイトURLを入力してください (省略可)
? モバイルページをサポートしますか? yes
? @kintone/plugin-uploaderを使いますか? yes
依存ライブラリをインストールします
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated @humanwhocodes/config-array@0.13.0: Use @eslint/config-array instead
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.
added 521 packages, and audited 522 packages in 1m
154 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Success! Created empty-plugin at empty-plugin
npm start
ファイルの変更を監視してプラグインのzipを自動的に作成するプロセスを起動します
その後、@kintone/plugin-uploaderにより、プラグインのzipは自動的にアップロードされます
npm run build
プラグインのzipを作成します
npm run lint
ESLintを使ってJavaScriptのソースコードをチェックします
まずは次のコマンドを実行してください
その後、あなたのkintone環境の情報を入力してください
cd empty-plugin
npm start
kintoneプラグイン開発をはじめましょう!
開発に関する情報はcybozu developer network:
https://cybozu.dev/ja/
質問に答えながら進めていく感じ、(省略可)となっているところはすべて省略しました。(重要)
📦 初期コマンドの実行
cd empty-plugin
npm start
そして表示されたメッセージ…
> empty-plugin@0.1.0 start
> node scripts/npm-start.js
> empty-plugin@0.1.0 develop
> npm run build -- --watch
> empty-plugin@0.1.0 upload
> kintone-plugin-uploader dist/plugin.zip --watch --waiting-dialog-ms 3000
> empty-plugin@0.1.0 build
> kintone-plugin-packer --ppk private.ppk --out dist/plugin.zip src --watch
"npm run develop" was failed
(え、最初の
npm start
でつまずくとかある?)
🔍 原因調査フェーズ突入
scripts/npm-start.js
見るpackage.json
見る- フォルダ構成チェック
…と、いろいろ見たけど結局わからず。(nodeに詳しかったらすぐわかるのかも)
🧪 コマンド直接叩いてみた
npm run build -- --watch
すると、こんなエラーが出力:
WARN: Property "homepage_url.en" is missing.
Invalid manifest.json:
- "/name/ja" must NOT have fewer than 1 characters
- "/description/ja" must NOT have fewer than 1 characters
Failed: Invalid manifest.json
(え、”省略可”って言ったよね?)
✅ 解決法
ということで、
empty-plugin
フォルダを削除- 再度
npx @kintone/create-plugin
で作り直し - 「日本語名」と「日本語の説明」を空欄にせず入力
これだけで動いた!
💡 まとめ:kintoneプラグイン開発でつまずかないために
- manifest.jsonのname/jaとdescription/jaは空欄にしない!
→ たとえ(省略可)
と書いてあっても、省略しない方が無難 - エラーが出たら
npm run build -- --watch
を直接叩いて原因調査
偏見だが国内メーカーのはこういうエラー隠しとかするのが厄介…
この記事が、未来のあなたの時間節約につながれば幸いです 🙌