-
Notifications
You must be signed in to change notification settings - Fork 81
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
Problems with running prod build #99
Comments
Hi @ItsInsajd ,
I understand now that it fails in case that the dist folder exist, but it does not contains config folder... So we have to check if exist dist/config path and create it.
Or
Please check the README generated under server part
So I have to fix that scenario. For the env variable, I notice that in some machine they are not read.
You can always check it in generated server README |
Hey, thanks for response. In my case,
So running
Buuuuut this still fails, because there is no main.js in |
Hi,
After this you can run Besides, for the env variables the generated project uses those defined in the .env file. Maybe in Azure or in the cloud that is ignored and you have to pass in the npm task ( However, I have to fix:
Thanks a lot for the feedbacks. |
Hey, to clarify, I ran If i understand you correctly, after build the main.js file should be in Anyways, it seems to work with node Thanks for your time :) |
@ItsInsajd you are welcome! feel free to say what you want :)
|
I'm checking on resolve-env branch @ItsInsajd , you can dowload that branch and check if is all ok? Follow the steps: https://github.com/jhipster/generator-jhipster-nodejs/tree/bug/resolve-env#-steps-to-develop-a-generator-feature-and-test-it However, the right paths, that I have fixed, of the main build under server is dist/main.js . I have added also integration test for this: https://github.com/jhipster/generator-jhipster-nodejs/runs/423982763 Besides I'm adding a feature with webpack for a full bundle.js that not require node_modules folder. |
Fix with #102 , I will release the 1.0.0-beta.3 |
Hi @ItsInsajd, |
Hey, sorry for late update, but it seems that indeed problems listed in this issue have been resolved. I can now run |
Hi @ItsInsajd , no problem for the delay.. you are welcome! |
Describe the bug
I wanted to check how reliable is to use nodejs blueprint to kickstart a project with azure deployment. Commands used for prod build do not work as excepted, but I may be doing something wrong, so I decided to ask here.
To Reproduce
Run blueprint as monolith, server only. Database probably doesn't matter, but i selected postgres. Then run
npm install
in main dir and in /server dir. Next:cd server
npm run build
First problem:
After running
npm run build
, it logs an error when running copy-resources script:After a bit of digging, it turns out an error lies in this part in copy-resources.js
I think because dist folder already exists after build,
/config
folder cannot be created and files cannot be copied properly. Movingfs.mkdirSync(out + '/config');
outside of thatif
fixes this problem.Second problem:
If then you try to use
node disc/src/main.js
to run the app, next problem arises.If you inspect the path where application.yml file should be, you'll notice it tries to find it inside dist/src/config/ file. But this file is inside
dist/scripts
, so this path is wrong. I fixed it by changing paths in config file:Third problem:
For some reason, env variables are not resolved on azure. For example, process.env.NODE_ENV is undefined and i had to hardcode 'prod' in this line
to make it work. NODE_ENV should come from .env file, but it's not resolved.
Expected behavior
App builds and starts as expected.
Desktop (please complete the following information):
Additional context
After one day of work, we managed to finally run it on azure, but env variables are in some parts hardcoded, which is far from ideal.
The text was updated successfully, but these errors were encountered: