フリーランス 技術調査ブログ

フリーランス/エンジニア Ruby Python Nodejs Vuejs React Dockerなどの調査技術調査の備忘録

strapiのCSVをインポートがうまくいかなかった

はじめに

大量のマスターデータをCSVを、strapiの管理画面からインポートする方法を探してみた。

CSVファイルインポート用プラグイン

インストール手順

  • 公式サイトによるとインストール手順は下記のようになる
cd my-strapi-project/plugins
git clone https://github.com/jbeuckm/strapi-plugin-import-content.git import-content
cd import-content && yarn install
yarn run setup --plugins
  • 最後の下記のコマンドを実行したところ、setupなどというコマンドはないとエラーが発生して
yarn run setup --plugins

下記のようなissueがあり、まだ解消されていなようでした. github.com

  • 公式サイトにも別の方法でのやり方が記載されていたが、結構、コーディングしないとダメそうなので、いったん見送る。 strapi.io

諦めたあと

  • 今回インストールしたプラグインを削除してstrapiのサーバーを起動しようとしたらエラーが発生して、プロジェクト全体が起動しなくなってしまった。 悲しく再度環境構築から始めることにする。
[2020-12-10T15:14:17.028Z] error Bootstrap function in plugin "users-permissions" failed
[2020-12-10T15:14:17.029Z] error TypeError: Cannot read property 'id' of null
    at /srv/backend/app/node_modules/strapi-plugin-users-permissions/services/UsersPermissions.js:263:59
    at Array.map (<anonymous>)
    at Object.updatePermissions (/srv/backend/app/node_modules/strapi-plugin-users-permissions/services/UsersPermissions.js:262:46)
    at async module.exports (/srv/backend/app/node_modules/strapi-plugin-users-permissions/config/functions/bootstrap.js:186:3)
    at async Promise.all (index 6)
    at async Strapi.runBootstrapFunctions (/srv/backend/app/node_modules/strapi/lib/Strapi.js:407:5)
    at async Strapi.load (/srv/backend/app/node_modules/strapi/lib/Strapi.js:339:5)
    at async Strapi.start (/srv/backend/app/node_modules/strapi/lib/Strapi.js:193:9)
error Command failed with exit code 1.