alakajam-team / alakajam

Website powering the Alakajam! game making community
https://alakajam.com/
Other
28 stars 13 forks source link

Bug on installation with SQLite #373

Closed Bigaston closed 5 years ago

Bigaston commented 5 years ago

Hello! I've try to install the website with the --build-from-source (because the first one doesn't work), but it's doesn't work. Do you have a solution? I've try to run the npm install sqlite3 --save but it's not work.

This is the first error.

$ npm install sqlite3 --save
Error: Cannot find module '/home/bigaston/alakajam/node_modules/sqlite3/lib/binding/node-v64-linux-x64/node_sqlite3.node'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/home/bigaston/alakajam/node_modules/sqlite3/lib/sqlite3.js:4:15)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Client_SQLite3._driver (/home/bigaston/alakajam/node_modules/knex/lib/dialects/sqlite3/index.js:75:12)
    at Client_SQLite3.initializeDriver (/home/bigaston/alakajam/node_modules/knex/lib/client.js:219:26)
    at Client_SQLite3.Client (/home/bigaston/alakajam/node_modules/knex/lib/client.js:113:10)
    at new Client_SQLite3 (/home/bigaston/alakajam/node_modules/knex/lib/dialects/sqlite3/index.js:58:20)

Do you have a solution? Thanks!

mkalam-alami commented 5 years ago

Installing sqlite3 can be quite annoying indeed. A couple things to try:

EDIT: Another workaround worth a shot: npm install https://github.com/mapbox/node-sqlite3/tarball/master

Bigaston commented 5 years ago

Okay the installation work and the server is working! Thanks!

But the CSS doesn't work...

mkalam-alami commented 5 years ago

Argh this one is new. You mean there is no CSS at all? Do you have any error either in the server logs or in the browser console? Thanks

Bigaston commented 5 years ago

On the SSH console I've this

bigaston@vps:~/alakajam$ node server.js
2018-11-08 03:51:58.689 WARN (?) Starting server...
2018-11-08 03:51:59.484 INFO (?) Setting up automatic CSS build...
>>      copying: assets/css/select2x2.png to static/css/select2x2.png
<>     watching: assets/css/select2x2.png
>>      copying: assets/css/select2.png to static/css/select2.png
<>     watching: assets/css/select2.png
<>     watching: assets/css/index.css
>>      copying: assets/css/icheck.png to static/css/icheck.png
<>     watching: assets/css/icheck.png
2018-11-08 03:52:00.041 INFO (?) Setting up automatic JS build...
2018-11-08 03:52:02.780 INFO (?) Hash: 3bcece0ea1aeeef47ab3
Version: webpack 4.3.0
Time: 2717ms
Built at: 2018-11-8 15:52:02
  Asset     Size  Chunks             Chunk Names
site.js  525 KiB    site  [emitted]  site
Entrypoint site = site.js
2018-11-08 03:52:03.649 WARN (/core/file-storage.js:22) Sharp dependency missing. Picture resizing disabled
2018-11-08 03:52:06.125 INFO (/core/db.js:32) Upgrading database...
2018-11-08 03:52:06.556 INFO (/core/db.js:40) Database is already at version 0027
2018-11-08 03:52:07.166 WARN (/server.js:89) Server started in 8.5s: http://localhost:8000/
=>     compiled: assets/css/index.css to static/css/index.css
<>     watching: /home/bigaston/alakajam/assets/css/lib/bootstrap.min.css
<>     watching: /home/bigaston/alakajam/assets/css/lib/bootstrap-datetimepicker.min.css
<>     watching: /home/bigaston/alakajam/assets/css/lib/fontawesome-all.min.css
<>     watching: /home/bigaston/alakajam/assets/css/lib/select2.min.css
<>     watching: /home/bigaston/alakajam/assets/css/lib/select2-bootstrap.min.css
<>     watching: /home/bigaston/alakajam/assets/css/lib/easymde.min.css
<>     watching: /home/bigaston/alakajam/assets/css/bootflat-custom.css
<>     watching: /home/bigaston/alakajam/assets/css/flipclock-custom.css
<>     watching: /home/bigaston/alakajam/assets/css/variables.css
<>     watching: /home/bigaston/alakajam/assets/css/general.css
<>     watching: /home/bigaston/alakajam/assets/css/navbar.css
<>     watching: /home/bigaston/alakajam/assets/css/home.css
<>     watching: /home/bigaston/alakajam/assets/css/post.css
<>     watching: /home/bigaston/alakajam/assets/css/user.css
<>     watching: /home/bigaston/alakajam/assets/css/event.css
<>     watching: /home/bigaston/alakajam/assets/css/event-themes.css
<>     watching: /home/bigaston/alakajam/assets/css/event-tournament.css
<>     watching: /home/bigaston/alakajam/assets/css/event-results.css
<>     watching: /home/bigaston/alakajam/assets/css/entry.css

And this in the browser console


GET http://localhost:8000/static/css/index.css?1541688863354 net::ERR_CONNECTION_REFUSED
(index):275 GET http://localhost:8000/static/images/default-banner.png net::ERR_CONNECTION_REFUSED
(index):303 GET http://localhost:8000/static/images/favicon16.png net::ERR_CONNECTION_REFUSED
(index):703 GET http://localhost:8000/static/js/jquery.min.js net::ERR_CONNECTION_REFUSED
(index):704 GET http://localhost:8000/static/js/jquery.lazy.min.js net::ERR_CONNECTION_REFUSED
(index):705 GET http://localhost:8000/static/js/bootstrap.min.js net::ERR_CONNECTION_REFUSED
(index):706 GET http://localhost:8000/static/js/bootstrap-datetimepicker.min.js net::ERR_CONNECTION_REFUSED
(index):707 GET http://localhost:8000/static/js/icheck.min.js net::ERR_CONNECTION_REFUSED
(index):708 GET http://localhost:8000/static/js/select2.full.min.js net::ERR_CONNECTION_REFUSED
(index):709 GET http://localhost:8000/static/js/lodash.min.js net::ERR_CONNECTION_REFUSED
(index):710 GET http://localhost:8000/static/js/tablesort-number-date.min.js net::ERR_CONNECTION_REFUSED
(index):712 GET http://localhost:8000/static/js/site.js?1541688863354 net::ERR_CONNECTION_REFUSED
(index):143 GET http://localhost:8000/static/images/welcome.png net::ERR_CONNECTION_REFUSED
(index):226 GET http://localhost:8000/static/images/default-avatar.png net::ERR_CONNECTION_REFUSED
(index):381 GET http://localhost:8000/static/images/social/twitter.svg net::ERR_CONNECTION_REFUSED
(index):386 GET http://localhost:8000/static/images/social/reddit.svg net::ERR_CONNECTION_REFUSED
(index):391 GET http://localhost:8000/static/images/social/irc.svg net::ERR_CONNECTION_REFUSED
(index):396 GET http://localhost:8000/static/images/social/twitch.png net::ERR_CONNECTION_REFUSED
(index):401 GET http://localhost:8000/static/images/social/youtube.svg net::ERR_CONNECTION_REFUSED
(index):406 GET http://localhost:8000/static/images/social/github.svg net::ERR_CONNECTION_REFUSED
(index):670 GET http://localhost:8000/static/images/social/black-twitter.svg net::ERR_CONNECTION_REFUSED
(index):674 GET http://localhost:8000/static/images/social/black-irc.svg net::ERR_CONNECTION_REFUSED
(index):678 GET http://localhost:8000/static/images/social/black-twitch.png net::ERR_CONNECTION_REFUSED
(index):681 GET http://localhost:8000/static/images/social/black-reddit.svg net::ERR_CONNECTION_REFUSED
(index):684 GET http://localhost:8000/static/images/social/black-youtube.svg net::ERR_CONNECTION_REFUSED
(index):687 GET http://localhost:8000/static/images/social/black-github.svg net::ERR_CONNECTION_REFUSED
localhost:8000/static/images/favicon32.png:1 GET http://localhost:8000/static/images/favicon32.png net::ERR_CONNECTION_REFUSED
localhost:8000/static/images/favicon16.png:1 GET http://localhost:8000/static/images/favicon16.png net::ERR_CONNECTION_REFUSED
localhost:8000/static/images/favicon196.png:1 GET http://localhost:8000/static/images/favicon196.png net::ERR_CONNECTION_REFUSED```

I've try to set the permission to 777 but nothing.
ttencate commented 5 years ago

Looks like all the assets are being served using absolute URLs? So if you're not actually running the server on the same host as the browser, it won't work.

Since you're already using ssh, you can use a tunnel to send localhost:8000 to port 8000 on your VPS.

You can also try setting STATIC_ROOT_URL in config.js to false, and ROOT_URL to something like http://1.2.3.4 where 1.2.3.4 is the IP address of your VPS.

Or just run everything on your local machine :)

Bigaston commented 5 years ago

I've modify that, but now the server is not starting :/

bigaston@vps:~/alakajam$ node server.js
2018-11-08 06:20:22.880 WARN (?) Starting server...
2018-11-08 06:20:23.692 ERROR (?) Unhandled promise rejection: /home/bigaston/al                                                                                                                                                             akajam/config.js:1
(function (exports, require, module, __filename, __dirname) { *module.exports =                                                                                                                                                              {
                                                              ^

SyntaxError: Unexpected token *
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at initFilesLayout (/home/bigaston/alakajam/server.js:141:18) Promise {
  <rejected> /home/bigaston/alakajam/config.js:1
(function (exports, require, module, __filename, __dirname) { *module.exports =                                                                                                                                                              {
                                                              ^

SyntaxError: Unexpected token *
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at initFilesLayout (/home/bigaston/alakajam/server.js:141:18) }
ttencate commented 5 years ago

Did you type a * at the start of config.js by accident?

Bigaston commented 5 years ago

Oh yeah! Thanks ^^'

And it's work now! Thanks!

Bigaston commented 5 years ago

I've see something, all of the icon doesn't work!

mkalam-alami commented 5 years ago

You're almost there!

The icons are based on Font Awesome, can you check if the font requests load correctly like below? (You might need to do F5 or Ctrl+F5 for them to refresh). Maybe you still have errors in your browser console.

clipboard02

EDIT: By icons you mean for instance the comments or diamond icons right?

Bigaston commented 5 years ago

Yeah, I can see some error in my console

Access to font at 'http://51.75.28.206:8000/static/webfonts/fa-solid-900.woff2' from origin 'http://vps.bigaston.me:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
(index):1 Access to font at 'http://51.75.28.206:8000/static/webfonts/fa-regular-400.woff2' from origin 'http://vps.bigaston.me:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
(index):1 Access to font at 'http://51.75.28.206:8000/static/webfonts/fa-solid-900.woff' from origin 'http://vps.bigaston.me:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
(index):1 Access to font at 'http://51.75.28.206:8000/static/webfonts/fa-regular-400.woff' from origin 'http://vps.bigaston.me:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
(index):1 Access to font at 'http://51.75.28.206:8000/static/webfonts/fa-regular-400.ttf' from origin 'http://vps.bigaston.me:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
(index):1 Access to font at 'http://51.75.28.206:8000/static/webfonts/fa-solid-900.ttf' from origin 'http://vps.bigaston.me:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
ttencate commented 5 years ago

Ah, you're contacting your VPS by hostname, but the resources are fetched by IP address. That makes the browser unhappy because it doesn't know that these are the same, so it thinks you're doing evil cross-domain requests.

Just update your config.js to use vps.bigaston.me instead of the IP address, and all should be fine.

Bigaston commented 5 years ago

Okay! I try it when I can. And a last question. There is a way to delete all the defalt event/games/user?

mkalam-alami commented 5 years ago

There is a way to delete all the defalt event/games/user?

Yup!

  1. Stop the server and delete the data/ folder
  2. Set DEBUG_INSERT_SAMPLES: false in config.js
  3. Restart the server
Bigaston commented 5 years ago

Okay! All work perfect! Thanks! We can edit the name and the logo of the website or not?

mkalam-alami commented 5 years ago

Technically you can yes, by replacing images in the sources and changing names in the code. The trick is we have not 100% designed the site as a neutral "game jam system", so you will have to explore the code to customize what you want.

Some examples:

Have fun :)

Bigaston commented 5 years ago

Okay! Thanks for all of your awnser!