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

How to add environment variable while using npm ? #68

Closed
matt734 opened this issue Jun 16, 2023 · 4 comments
Closed

How to add environment variable while using npm ? #68

matt734 opened this issue Jun 16, 2023 · 4 comments

Comments

@matt734
Copy link

matt734 commented Jun 16, 2023

I am trying to run yaade on my ubuntu machine using npm. I tried setting the env using export YAADE_ADMIN_USERNAME=admin but I doesn't work. ofc it works while I run it using the executable jar file but when I use npm run dev it doesn't work. what's the workaround for this ?

@jonrosner
Copy link
Contributor

You cannot run Yaade exclusively using NPM. NPM can only build and serve the frontend part (static HTML, CSS, JavaScript). To run Yaade you need to:

a) run it as a docker container
b) build a jar using the build script mentioned in the README
c) run it in development mode

If you go for (b) the script will build the frontend, put the static files into the static folder of the server, build the server, and then output a single jar file that you can run normally.

If you go for step (c), then you need to start up all components manually:

  1. The server by running the jar (this is where you set YAADE_ADMIN_USERNAME=admin)
  2. Frontend by running npm run dev
  3. The dev-proxy to connect frontend and backend and to disable CORS

Now you should be able to go to http://localhost:9337 and login. Note that this should only be used for development.

@matt734
Copy link
Author

matt734 commented Jun 16, 2023

You cannot run Yaade exclusively using NPM. NPM can only build and serve the frontend part (static HTML, CSS, JavaScript). To run Yaade you need to:

a) run it as a docker container b) build a jar using the build script mentioned in the README c) run it in development mode

If you go for (b) the script will build the frontend, put the static files into the static folder of the server, build the server, and then output a single jar file that you can run normally.

If you go for step (c), then you need to start up all components manually:

  1. The server by running the jar (this is where you set YAADE_ADMIN_USERNAME=admin)
  2. Frontend by running npm run dev
  3. The dev-proxy to connect frontend and backend and to disable CORS

Now you should be able to go to http://localhost:9337 and login. Note that this should only be used for development.

@matt734
Copy link
Author

matt734 commented Jun 16, 2023

I am not sure where I did wrong but I wanted to make some changes in the front end part. I changed the logo on client/src/pages/login/Login.tsx . I am able to see the changes which I made when I run npm run dev but not able to see the changes when I run using the executable jar file

@jonrosner
Copy link
Contributor

Yes if you actually want to make changes you need to run the three components in dev mode as I explained above.

@matt734 matt734 closed this as completed Jun 21, 2023
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