ryan-d-williams / MMM-GoogleSheets

Google Sheets Module for MagicMirror
23 stars 2 forks source link

MagicMirror failing to start #20

Closed skillfulfrog closed 2 years ago

skillfulfrog commented 2 years ago

Followed the instructions on the page, whenever I start my magic mirror it fails. Wondering if you have any insight.

ryan-d-williams commented 2 years ago

@skillfulfrog what are your indications? What does your config file look like?

skillfulfrog commented 2 years ago

I keep getting "Could not load config file" when I attempt to run MagicMirror. My config file is the sample which you posted, using my own URL from the google app.

ryan-d-williams commented 2 years ago

@skillfulfrog that sounds like your overall config file is not formatted properly, not something to do with the module. If the entire magicmirror cannot load the config file, it is unlikely to be an issue with the module. It could also be that the config file is not in the correct location, so the magicmirror cannot find the file to load.

If you post your full config file I might be able to find the issue.

skillfulfrog commented 2 years ago

Here is the piece from my config file:

{ module: "MMM-GoogleSheets", header: "Google Sheets", position: "bottom_right", config: { url: "https://script.google.com/macros/s/AKfycbxS7tvQViVgvsrqSJyKDZEhZPtr4oXcbSTgSyxM3JXNyTxDlfNX_QAiaUNXUtPl94Yp0w/exec", sheet: "Sheet1", range: "A1:B6" } },

I just tried removing this part and everything worked as expected. If it means anything I am also using the pages module. Am I supposed to run "npm install" in the module folder?

skillfulfrog commented 2 years ago

I also get the following error message:

'MODULE_NOT_FOUND', requireStack: [ '/home/pi/MagicMirror/modules/MMM-GoogleSheets/node_helper.js', '/home/pi/MagicMirror/js/app.js', '/home/pi/MagicMirror/js/electron.js', '/home/pi/MagicMirror/node_modules/electron/dist/resources/default_app.asar/main.js'

ryan-d-williams commented 2 years ago

If you are getting a MODULE_NOT_FOUND error, that means the MM is unable to find the requested module from the config file. Did you complete step 2 from the installation process (the step involving cloning the module repository to the modules folder)? Note that step 2 is standard for any MM module - you must download the module to your modules folder in order for it to work.

It sounds like MM is attempting to find the MMM-GoogleSheets module in the modules folder and cannot find it. Can you post a screenshot of your modules folder?

skillfulfrog commented 2 years ago

The module is in the folder, I've followed the steps multiple times. I did notice that my MagicMirror is version 2.17, and I know you said it needs to be 2.2. I tried updating this but it says that it is the latest version.

ryan-d-williams commented 2 years ago

2.2 is a typo (thanks for pointing that out). It looks like 2.17 is the most recent version. 2.17 is fine (the only major requirement is the nunjucks templating system)

When you open the MMM-GoogleSheets folder in the module folder, do you see the node_helper.js file? From your stack trace, that is the file it cannot find. Note that it must be in the base MMM-GoogleSheets folder, it cannot be in a subfolder

skillfulfrog commented 2 years ago

capture This is what is inside the MMM-GoogleSheets folder.

ryan-d-williams commented 2 years ago

Okay that looks like it's good to go.

Can you post the entire output you see when you try to start the MM?

ryan-d-williams commented 2 years ago

Additionally, try npm install in the base folder

skillfulfrog commented 2 years ago

These are the error messages I get in the log. I did run npm install in ~/MagicMirror/modules/MMM-GoogleSheets. Capture1 Capture2

ryan-d-williams commented 2 years ago

Looks like the issue is not the MMM-GoogleSheets module, it cannot find the node_module "request" (first screenshot).

Try npm install in the base folder

If that doesn't work, try npm install request

skillfulfrog commented 2 years ago

By base folder do you mean in the MMM-GoogleSheets, or in the Modules folder?

ryan-d-williams commented 2 years ago

It's been a while since I've looked at the file structure, but it should be the base "MagicMirror" folder.

skillfulfrog commented 2 years ago

Tried reinstall the module, still having errors. I just might not be able to include this module in my design.

ryan-d-williams commented 2 years ago

The problem is not with the module installation. The problem is that MM cannot find the "request" module. It used to come standard with MM. I will look into if that is no longer the case.

If you go to the module folder, and try npm install request, it should install the request module into that folder for the module to see.

skillfulfrog commented 2 years ago

Using the npm install request worked, and the Mirror runs. I am running into a problem where the sheet is stuck on "loading". Do you know how to fix?

ryan-d-williams commented 2 years ago

It looks like your google apps script is not set up correctly. When I click on your link from the config file, I see the error:

"Script function not found: doGet"

That means it was not set up properly. Did you follow the steps to include the google apps script library listed in the instructions as well as make sure you have a function called doGet in your script?

skillfulfrog commented 2 years ago

I followed the directions. This is the only code I have in the script: function doGet(e){ return MMMGoogleSheets.doGet(e); }

skillfulfrog commented 2 years ago

Do I need to "enable" the script in my google sheet?

ryan-d-williams commented 2 years ago

I'm not sure what that means. You don't have to do anything outside of the directions.

That error means that whichever script you deployed via the instructions, it does not think there is a function called "doGet" which is key to the operation of the module.

I would make sure the code is saved like you have above and follow the deployment steps again.

skillfulfrog commented 2 years ago

Okay I will try running through the steps again, I think the UI has slightly changed since you posted the latest instructions.

ryan-d-williams commented 2 years ago

Okay thank you for the info! I will take a look.

skillfulfrog commented 2 years ago

Tried following the directions again, still no luck. I'm not sure what I am doing wrong.

ryan-d-williams commented 2 years ago

What is the new link you are putting in the config file?

skillfulfrog commented 2 years ago

https://script.google.com/macros/s/AKfycbxS7tvQViVgvsrqSJyKDZEhZPtr4oXcbSTgSyxM3JXNyTxDlfNX_QAiaUNXUtPl94Yp0w/exec

ryan-d-williams commented 2 years ago

Try clicking that link. You will see "the requested file does not exist". That means the deployment is not happening

I tried following the directions again myself with a new test project. While you are correct the UI has changed, the deployment process has not and it is working as expected. Make sure you are copying the link from the new deployment, and that is deployed as a web app that can be run by anyone, even anonymous.

skillfulfrog commented 2 years ago

Got it to work, thank you for your help! Do you have the config parameters for the second "scoreboard" image you uploaded?

ryan-d-williams commented 2 years ago

No problem! Do you mind giving a brief description of what you did differently that got it to work in case anyone in the future reads this thread and has the same problem?

I don't have the exact config for that example. However, there are many different ways you could make that happen

  1. Style it exactly like that in your google sheet (with the black background on all but the first row) and use the mimic style
  2. Use any of the styles that ignore the background color of your google sheet and then use the headerStyle property to just change the first row to gray

There are a few more ways but I imagine those are the two easiest. I tried to add as many modes of customization when designing the module to keep the possibilities open to whatever people wanted to create!