質問をすることでしか得られない、回答やアドバイスがある。

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

新規登録して質問してみよう
ただいま回答率
85.46%
Google カレンダー

Google カレンダーは、Google社が提供する無料のスケジュール管理ツールです。パソコンやスマートフォン、タブレットなどからアクセスし、スケジュールの追加・変更が可能。Googleアカウントがあれば誰でも使用できます。

Yarn

Yarnは、Facebook/Exponent/Google/Tildeが開発したJavaScriptのパッケージマネージャ。npmよりもインストールが速く、厳密にモジュールのバージョンを固定できるなど、npmの問題を解決。npmと互換性があり、同じpackage.jsonを使用できます。

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

プラグイン

プラグイン(plug-in)は、ソフトウェアアプリケーションの機能拡張の為に開発された、一組のソフトウェアコンポーネントのことを指します。

Q&A

0回答

912閲覧

package.jsonが自動更新されない

kengoo

総合スコア10

Google カレンダー

Google カレンダーは、Google社が提供する無料のスケジュール管理ツールです。パソコンやスマートフォン、タブレットなどからアクセスし、スケジュールの追加・変更が可能。Googleアカウントがあれば誰でも使用できます。

Yarn

Yarnは、Facebook/Exponent/Google/Tildeが開発したJavaScriptのパッケージマネージャ。npmよりもインストールが速く、厳密にモジュールのバージョンを固定できるなど、npmの問題を解決。npmと互換性があり、同じpackage.jsonを使用できます。

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

プラグイン

プラグイン(plug-in)は、ソフトウェアアプリケーションの機能拡張の為に開発された、一組のソフトウェアコンポーネントのことを指します。

0グッド

0クリップ

投稿2021/12/28 22:48

前提・実現したいこと

Rails6でFullCalendarを導入しています。
開発環境でカレンダーの表示までできたのですが、
祝日をわかりやすく表示するためyarn add @fullcalendar/google-calendarコマンドでGoogleカレンダーのプラグインを追加しようとしたところ、
カレンダーが表示されなくなってしまいました。

発生している問題・エラーメッセージ

Console

Uncaught SyntaxError: Unexpected token '!'

該当のソースコード

app/javascript/packs/application.js以前

// This file is automatically compiled by Webpack, along with any other files // present in this directory. You're encouraged to place your actual application logic in // a relevant structure within app/javascript and only use these pack files to reference // that code so it'll be compiled. require("@rails/ujs").start() require("turbolinks").start() require("@rails/activestorage").start() require("channels") // Uncomment to copy all static images under ../images to the output folder and reference // them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>) // or the `imagePath` JavaScript helper below. // // const images = require.context('../images', true) // const imagePath = (name) => images(name, true) import { Calendar } from '@fullcalendar/core'; import dayGridPlugin from '@fullcalendar/daygrid'; import interactionPlugin from '@fullcalendar/interaction'; document.addEventListener('turbolinks:load', function() { var calendarEl = document.getElementById('calendar'); var calendar = new Calendar(calendarEl, { locale: 'ja', dayCellContent: function(e) { e.dayNumberText = e.dayNumberText.replace('日', ''); }, buttonText: { today: '今日', }, plugins: [ dayGridPlugin, interactionPlugin ] }); calendar.render(); });

app/javascript/packs/application.js作業後

// present in this directory. You're encouraged to place your actual application logic in // a relevant structure within app/javascript and only use these pack files to reference // that code so it'll be compiled. require("@rails/ujs").start() require("turbolinks").start() require("@rails/activestorage").start() require("channels") // Uncomment to copy all static images under ../images to the output folder and reference // them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>) // or the `imagePath` JavaScript helper below. // // const images = require.context('../images', true) // const imagePath = (name) => images(name, true) import { Calendar } from '@fullcalendar/core'; import dayGridPlugin from '@fullcalendar/daygrid'; import interactionPlugin from '@fullcalendar/interaction'; import googleCalendarApi from '@fullcalendar/google-calendar' document.addEventListener('turbolinks:load', function() { var calendarEl = document.getElementById('calendar'); var calendar = new Calendar(calendarEl, { locale: 'ja', dayCellContent: function(e) { e.dayNumberText = e.dayNumberText.replace('日', ''); }, buttonText: { today: '今日', }, plugins: [ dayGridPlugin, interactionPlugin, googleCalendarApi ], googleCalendarApiKey: 'xxxx', events: { googleCalendarId: 'ja.japanese#holiday@group.v.calendar.google.com', rendering: 'background', color:"#ffd0d0" } }); calendar.render(); });

package.json

{ "name": "habits", "private": true, "dependencies": { "@rails/actioncable": "^6.0.0-alpha", "@rails/activestorage": "^6.0.0-alpha", "@rails/ujs": "^6.0.0-alpha", "@rails/webpacker": "4.3.0", "turbolinks": "^5.2.0" }, "version": "0.1.0", "devDependencies": { "webpack-dev-server": "^4.2.1" } }

試したこと

試したyarnコマンド
rm -rf node_modules/
rm -rf yarn.lock
yarn install
yarn upgrade(実行不可)

package.jsonファイルが更新されていないことに気づきました。

補足情報(FW/ツールのバージョンなど)

Rails 6.0.4.1
node 17.0.1
yarn 1.22.17

初心者で初歩的な抜け漏れ等あると思いますがよろしくお願いします。

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

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

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

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

y_waiwai

2021/12/28 23:05

エラーが出たなら、エラーメッセージを提示しましょう エラーメッセージは、いらぬ翻訳省略しないで、出たそのママをコピペで提示してください
kengoo

2021/12/28 23:58

ご指摘ありがとうございます。 DeveloperToolsのConsole上に Uncaught SyntaxError: Unexpected token '!' とだけ表示してありました。 指定した範囲は下記になります。 !(function webpackMissingModule() { var e = new Error("Cannot find module '@fullcalendar/core'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(calendarEl, { 他にも必要事項あればご指摘よろしくお願いします。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

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

ただいまの回答率
85.46%

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

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

質問する

関連した質問