Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web page not found - some install issues #1

Open
waninggibbous opened this issue Jul 12, 2023 · 10 comments
Open

Web page not found - some install issues #1

waninggibbous opened this issue Jul 12, 2023 · 10 comments

Comments

@waninggibbous
Copy link

waninggibbous commented Jul 12, 2023

Hi, looking forward to using this but I have hit a few problems. I am on a pi 4B running 64-bit OS. Hope you can help.

I followed the instructions and here is where I hit issues:

  1. Upon creating the netlify app, which I think I did correctly, I just get a "Page not found" error when launching the page.
  2. I installed nvm and confirmed it is installed successfully but the startup script doesn't recognize it:
    ./setup.sh: line 7: /root/.nvm/nvm.sh: No such file or directory
    ./setup.sh: line 8: nvm: command not found
    If I run "which node" I get "/home/raspberry/.config/nvm/versions/node/v20.4.0/bin/node"

The rest of the script seemed to run OK.
I reviewed what the script was attempting to do and manually updated the node path in gatefold.sh
3) The service was failing with a user error. I saw in the raspotify systemctl unit file that the user was set to "pi", which I am not using on my system. I edited the file to use a valid ID and the raspotify service is now working (correctly identifying the Raspberry Pi as an available speaker).

So my outstanding issue is that the gatefold page is showing a "Page not found" error.

Thanks in advance!

@JamieGoodson
Copy link
Owner

JamieGoodson commented Jul 13, 2023

Hi! Couple things to start with:

  1. I think you may be the first person using Gatefold 🎉
  2. Sorry that it failed 😅 Thanks for creating an issue ticket

Netlify
Do you mind posting your Netlify site's 'Build configuration' (see below screenshot) - can be found under the 'Site configuration' tab on the left
image

Also are you seeing any errors in the website's console (Right click anywhere on your Gatefold website's page > 'Inspect' > Go to the 'Console' tab?

Setup script
Are you running the setup script with sudo/as the root user? If so, this will be an issue as nvm is not intended to be installed on the root user. Please try running the script again without sudo.

I saw in the raspotify systemctl unit file that the user was set to "pi", which I am not using on my system

Good point, I'll update the readme to suggest that the user in the unit file should be updated if they're not using the default pi user 👍

@waninggibbous
Copy link
Author

Hi, happy to help you test it! I can also give you some feedback once I get it running.

On the build configuration I changed it to match the screenshot and I am now getting a black screen, so I guess that is a step in the right direction.
The inspect/console for this page now shows:
Connecting to MQTT broker at wss://broker.emqx.io:8084/mqtt 2.14624c17.js:2
MQTT: Connected 2.14624c17.js:2

The following items were previously different: "build command" was blank and "publish directory" was "webapp". One point which may be of interest: previously (before I made these changes) I was able to view the Steely Dan album cover using https://[my site].netlify.app/static/steely-dan-cover.jpg and that doesn't work anymore.

I tried running setup.sh (I don't think I ran it as root before but may have tried it). Here is the output:
./setup.sh: line 7: /home/raspberry/.nvm/nvm.sh: No such file or directory
./setup.sh: line 8: /home/raspberry/.nvm/nvm.sh: No such file or directory
./setup.sh: line 9: nvm: command not found
cp: cannot create regular file '.env': Permission denied

Enter your GitHub username: [I Ctrl-C'ed at this point]

Some other potentially useful stuff:
"command -v nvm" returns "nvm"
"which node" returns "/home/raspberry/.config/nvm/versions/node/v20.4.0/bin/node"

thanks!

@waninggibbous
Copy link
Author

waninggibbous commented Jul 13, 2023

Some more info. I redeployed the app and restarted raspotify. raspotify is working (gatefold is still a black screen) but "systemctl status raspotify" returned these messages:

Jul 13 16:41:29 raspberrypi librespot[11096]:     at moduleResolve (node:internal/modules/esm/resolve:830:20)
Jul 13 16:41:29 raspberrypi librespot[11096]:     at defaultResolve (node:internal/modules/esm/resolve:1035:11)
Jul 13 16:41:29 raspberrypi librespot[11096]:     at DefaultModuleLoader.resolve (node:internal/modules/esm/loader:251:12)
Jul 13 16:41:29 raspberrypi librespot[11096]:     at DefaultModuleLoader.getModuleJob (node:internal/modules/esm/loader:140:32)
Jul 13 16:41:29 raspberrypi librespot[11096]:     at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:33)
Jul 13 16:41:29 raspberrypi librespot[11096]:     at link (node:internal/modules/esm/module_job:75:36) {
Jul 13 16:41:29 raspberrypi librespot[11096]:   code: 'ERR_MODULE_NOT_FOUND'
Jul 13 16:41:29 raspberrypi librespot[11096]: }
Jul 13 16:41:29 raspberrypi librespot[11096]: Node.js v20.4.0
Jul 13 16:41:29 raspberrypi librespot[11050]: [2023-07-13T20:41:29Z WARN  librespot] On event program returned exit code 1

@JamieGoodson
Copy link
Owner

JamieGoodson commented Jul 13, 2023

Thanks for the detailed info!

Netlify
When setting up the site on Netlify, the Gatefold readme states:

Set the 'Base directory' to webapp, leave all other settings as whatever Netlify sets.

So perhaps because you'd set webapp as the 'Publish directory' instead, the other fields weren't set correctly since Netlify auto populates the 'Publish directory' based on the 'Base directory' (the 'Build command' should auto generate too). I've just updated the readme to make this even clearer for others.

A black screen for the website is correct - it means Gatefold is waiting for you to play a track. So at least it looks like the website is setup now! 🙂

I was able to view the Steely Dan album cover using https://[my site].netlify.app/static/steely-dan-cover.jpg and that doesn't work anymore

This is expected behavior 👍

Setup script

./setup.sh: line 7: /home/raspberry/.nvm/nvm.sh: No such file or directory

This makes me think nvm isn't installed correctly. How did you install it?

By default, when you first install nvm, it places a script in ~/nvm/.nvm.sh that must be ran at least once per shell session to make the nvm command available. You yourself don't need to do this when using nvm at the command line normally because the nvm installer should've placed a line in your ~/.bashrc (which runs whenever you SSH into your pi) that does this for you. However, in the Gatefold setup script, we need to run this line manually since it's a separate bash session. If the nvm script doesn't exist in ~/nvm/.nvm.sh for you, then I think either you have a very old version of nvm or it wasn't installed correctly.

What output do you get if you run nvm -v (no sudo)?

@JamieGoodson
Copy link
Owner

JamieGoodson commented Jul 13, 2023

For your code: 'ERR_MODULE_NOT_FOUND' error message, there's 2 lines missing from the setup script (thanks for making me aware!). I've just updated the script. The missing lines were:

nvm use
npm install

(which must be ran inside gatefold/raspotify/)

Please could you try doing a git pull on your Pi please and re-running the setup script?

@JamieGoodson
Copy link
Owner

JamieGoodson commented Jul 14, 2023

cp: cannot create regular file '.env': Permission denied

This one I'm not sure I know the cause. The full line in the script is just:

cp .env.template .env

So if this is failing, then it looks like your user doesn't have write permissions to wherever you've stored the Gatefold repo. What's the full path you've placed the repo folder at? My recommendation is to just put it in your home folder (~/). Perhaps you cloned the repo using sudo (so now the owner of the directory is the root user and not the raspberry user)?

@waninggibbous
Copy link
Author

waninggibbous commented Jul 14, 2023

Thanks for your help. The good news is that after making your changes it started working:
2023-07-14-091820_1920x1080_scrot (1)

However, the script was still failing. I think the reason gatefold was working is because I manually replaced environment variables, ran stuff directly from the command line, etc when I was tinkering before I raised the issue. But I wanted to get the script running correctly so it is repeatable.

Starting wih the .env permission error when renaming, I saw that it was owned by root, probably as a result of running the script via sudo at some point previously.

Next, nvm. Interestingly the nvm commands in your script ran from my command line but not within the script.

I had another look at the nvm readme and saw this note:
If the environment variable $XDG_CONFIG_HOME is present, it will place the nvm files there.

This was correct for me:

raspberry@raspberrypi:~/gatefold/raspotify $ echo $XDG_CONFIG_HOME
/home/raspberry/.config
raspberry@raspberrypi:~/gatefold/raspotify $ which node
/home/raspberry/.config/nvm/versions/node/v18.16.1/bin/node

I also poked around for help online and found this page which had a suggestion of running the script with a dot in front of it make the script to be able to change stuff in my current shell, so
. ./setup.sh

Now the script works although it still generates an error message.

bash: /home/raspberry/.config/nvm/nvm.sh: Permission denied
Found '/home/raspberry/gatefold/raspotify/.nvmrc' with version <v18.16.1>
v18.16.1 is already installed.
Now using node v18.16.1 (npm v9.5.1)
Found '/home/raspberry/gatefold/raspotify/.nvmrc' with version <v18.16.1>
Now using node v18.16.1 (npm v9.5.1)

up to date, audited 46 packages in 964ms

8 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Enter your GitHub username:

I looked at the permissions for the nvm.sh file in the error message and they are -rw-r--r--, so there no execute permissions for anybody. I didn't want to mess with this by changing permissions so I have left it.

I think we are basically there but it would be nice to get the setup to run with no errors. At some point I am going to reinstall the OS and will try to reinstall this but I am happy to help in the meantime.

@JamieGoodson
Copy link
Owner

@waninggibbous Sorry for the enormously late reply on this - life has gotten in the way! Glad you managed to get it working and thanks a lot for outlining the steps needed to resolve. Will update the repo when I next get the chance (unfortunately life is still in the way 🙃).

@waninggibbous
Copy link
Author

@JamieGoodson thanks for following up. I have been using it occasionally and can suggest a couple of enhancements. You can decide whether they are things you want to pursue if/when you haev time. If you like I can create a new issue with some ideas.

@JamieGoodson
Copy link
Owner

@waninggibbous Sure, I'm all ears!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants