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

Can't build with yarn #227

Closed
KartoniarzEssa opened this issue Dec 28, 2022 · 47 comments · Fixed by #228
Closed

Can't build with yarn #227

KartoniarzEssa opened this issue Dec 28, 2022 · 47 comments · Fixed by #228

Comments

@KartoniarzEssa
Copy link

chuj@chuj:~/darkwire.io$ yarn build
yarn run v1.22.19
$ ./build.sh
building client...
[1/4] Resolving packages...
success Already up-to-date.
$ tsc && vite build
src/main.tsx:12:28 - error TS2307: Cannot find module '@/store/' or its corresponding type declarations.

12 import configureStore from '@/store/';
~~~~~~~~~~

src/main.tsx:13:18 - error TS2307: Cannot find module '@/components/Home/' or its corresponding type declarations.

13 import Home from '@/components/Home/';
~~~~~~~~~~~~~~~~~~~~

src/main.tsx:14:33 - error TS2307: Cannot find module '@/utils/dom' or its corresponding type declarations.

14 import { hasTouchSupport } from '@/utils/dom';
~~~~~~~~~~~~~

Found 3 errors in the same file, starting at: src/main.tsx:12

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
building server...
[1/4] Resolving packages...
success Already up-to-date.
$ echo 'Nothing to build here.'
Nothing to build here.
Done in 4.83s.

@KartoniarzEssa
Copy link
Author

I fixed everything by changing

import configureStore from '@/store/';
import Home from '@/components/Home/';
import { hasTouchSupport } from '@/utils/dom';

to

import configureStore from './store/';
import Home from './components/Home/';
import { hasTouchSupport } from './utils/dom';

then when yarn build worked i linked client/dist folder to client/build using command below
ln -s client/dist client/build
then the darkwire worked

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

Thanks for reporting @KartoniarzEssa It should be fixed now. Let me know if you experience new trouble.

@KartoniarzEssa
Copy link
Author

KartoniarzEssa commented Dec 29, 2022

Thanks for reporting @KartoniarzEssa It should be fixed now. Let me know if you experience new trouble.

@jrmi Now building the Dockerfile have problem because you change the container to alpine that have apk as package manager not apt. To fix it you must change to debian-based distro.

node:18-bullseye seems to work fine

You should expose the port from docker container too:
$ docker run --name darkwire.io -p 3001:3001 -d --env STORE_HOST=redis://redis.host:6379 darkwire.io

@KartoniarzEssa
Copy link
Author

KartoniarzEssa commented Dec 29, 2022

@jrmi Also, there are 2 more errors that i don't know how to resolve, first is only some warnings while building docker container, but idk if they're important
image

I configured everything in .env files, i tried with redis and with memory storage. Neither works for me
image

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

Thanks again for reporting. The error you're seeing during the build are more a warning because of some obsolete dependencies (I'm trying to replace them) and because of the final size of the build. These two are not blocking I guess.

The error you're experiencing in your browser is probably caused by the fact you're accessing Darkwire through a http connection. Check out this issue #195 you'll see the same error. If you want to solve that you should use a httpS connection. I should make the error more clear or may be use something like https://www.npmjs.com/package/webcrypto-shim in this case.

@KartoniarzEssa
Copy link
Author

KartoniarzEssa commented Dec 29, 2022

@jrmi Ok now I have a certificate and a https, I'm even listed in a room and I can text but after refresh everything disappears, and it says that it's disconnected idk from what. Redis? API?
image

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

This message is displayed when you are disconnected from the websocket. Redis is not used anymore. If you've used a reverse proxy to add the certificate and the https you probably also need some configuration to make the websockets work. What have you used as reverse proxy?

@KartoniarzEssa
Copy link
Author

@jrmi I used nginx and this is config
image

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

Take a look at this link https://www.nginx.com/blog/websocket-nginx/
I think this configurations are missing:

    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $host;

May be more.

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

I've published a new version with a improved version of docker file and docker compose and I've applied your suggestion to the readme. Let me know what you think.

@KartoniarzEssa
Copy link
Author

little typos
image

@KartoniarzEssa
Copy link
Author

And I think i found the problem, idk what that means tho
image

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

nvm is not a typo it's a tool to manage node version. Was it the typo?

@KartoniarzEssa
Copy link
Author

Oh i thought its meant to be npm

@KartoniarzEssa
Copy link
Author

And I think i found the problem, idk what that means tho image

This is probably CORS

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

Yeah something like that. Or content security policy are wrong. Sometimes it also shows that when there is no websocket server at all. Are you trying a localhost version?

@KartoniarzEssa
Copy link
Author

Where can I change this localhost to my domain

This is client .env file
image

And this is server .env file
image

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

It should be in the client .env file. But you might have to recreate your docker image (if you are using docker).

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

You might have to recreate you docker image from scratch also. (docker build...)

@KartoniarzEssa
Copy link
Author

Now Im not even using docker

@KartoniarzEssa
Copy link
Author

for now

@KartoniarzEssa
Copy link
Author

My domain should be in VITE_API_HOST?

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

Yes.
Can you describe me what is your setup? How have you launched darkwire frontend and backend?

@KartoniarzEssa
Copy link
Author

I just starting it by using yarn start in darkwire.io folder

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

Ok so you might have to execute yarn build again to update the build with the right env vars.

@KartoniarzEssa
Copy link
Author

every change i run ./build.sh

@KartoniarzEssa
Copy link
Author

Seems like its ignoring .env file
image

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

Remove the client/dist dir to check it breaks the server and then rebuild it?

@KartoniarzEssa
Copy link
Author

yup it breaks
image

@KartoniarzEssa
Copy link
Author

After rebuild same error in console

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

Can you try to rebuild the client from it's own directory?

cd client
yarn build
cd ..
yarn start

@KartoniarzEssa
Copy link
Author

KartoniarzEssa commented Dec 29, 2022

Now its working but not, the error is the same, but the domain is set
image

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

What do you see if you visit https://yourdomain/socket.io/ ?

@KartoniarzEssa
Copy link
Author

image

@KartoniarzEssa
Copy link
Author

But its without port in the console its with port

@KartoniarzEssa
Copy link
Author

And maybe this is problem

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

But if you're behind a nginx reverse proxy, you might need no port (or port 443).

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

What is the url you use in the browser?

@KartoniarzEssa
Copy link
Author

its without port, but in console the error is with port

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

So remove the port!

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

(use 443)

@KartoniarzEssa
Copy link
Author

OK I set the port in client .env to 443 and its working
image

@KartoniarzEssa
Copy link
Author

Thanks for support and help

@jrmi
Copy link
Collaborator

jrmi commented Dec 29, 2022

Congrats :) and good night. I have published a version that fixes the build problem not using .env file FYI.

@KartoniarzEssa
Copy link
Author

I also translate the panel to polish if you want

{
"newRoomButton": "Nowy pokój",
"lockedRoom": "{username} zablokował pokój",
"unlockedRoom": "{username} odblokował pokój",
"agreement": "Korzystając z darkwire, zgadzasz się na naszą politykę zasad korzystania i warunki korzystania",
"typePlaceholder": "Pisz tutaj",
"aboutButton": "O nas",
"settingsButton": "Ustawienia",
"settings": "Ustawienia",
"aboutHeader": "O nas",
"copyButtonTooltip": "Skopiowano",
"welcomeHeader": "Witamy na czacie Starymisiada",
"sentFile": "Wysłałeś {filename}",
"userJoined": "{username} dołączył",
"userLeft": "{username} opuścił",
"userSentFile": "{username} wysłał Ci plik.",
"downloadFile": "Pobierz {filename}",
"nameChange": "{oldUsername} zmienił swoje imię na {newUsername}",
"settingsHeader": "Ustawienia & Pomoc",
"copyRoomHeader": "Ten pokój",
"languageDropdownHeader": "Język",
"roomOwnerHeader": "Własność pokoju",
"roomOwnerText": "Osoba, która utworzyła pokój, jest właścicielem pokoju i ma specjalne uprawnienia, takie jak możliwość zablokowania i odblokowania pokoju. Jeśli właściciel opuści pokój, druga osoba, która dołączy, przejmuje własność. Jeśli ona opuści, trzecia osoba staje się właścicielem itd. Właściciel pokoju ma ikonę gwiazdki obok swojej nazwy użytkownika w rozwijanej liście uczestników.",
"lockRoomHeader": "Zablokuj pokój",
"lockRoomText": "Jeśli jesteś właścicielem pokoju, możesz zablokować i odblokować pokój, klikając ikonę zamka w pasku nawigacyjnym. Gdy pokój jest zablokowany, żadna inna osoba nie może do niego dołączyć.",
"slashCommandsHeader": "Komendy",
"slashCommandsText": "Dostępne są następujące komendy:",
"slashCommandsBullets": [
"zmienia nazwę użytkownika",
"wykonuje akcję",
"czyści historię wiadomości",
"wyświetla wszystkie komendy"
],
"sound": "Dźwięk",
"newMessageNotification": "Powiadomienie o nowej wiadomości",
"desktopNotification": "Powiadomienie na pulpicie",
"desktopNotificationBlocked": "Powiadomienia na pulpicie zostały wyłączone",
"welcomeModalCTA": "Ok",
"lockedRoomHeader": "Ten pokój jest zablokowany",
"helpTranslate": "Pomóż nam przetłumaczyć darkwire!"
}

@jrmi
Copy link
Collaborator

jrmi commented Dec 30, 2022

Great! Would you mind to review this MR #231

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

Successfully merging a pull request may close this issue.

2 participants