vuestorefront / vue-storefront-1

The open-source frontend for any eCommerce. Built with a PWA and headless approach, using a modern JS stack. We have custom integrations with Magento, commercetools, Shopware and Shopify and total coverage is just a matter of time. The API approach also allows you to merge VSF with any third-party tool like CMS, payment gateways or analytics. Newest updates: https://blog.vuestorefront.io. Always Open Source, MIT license.
https://www.vuestorefront.io
MIT License
19 stars 13 forks source link

In Kubernetes pods - Error: Cannot find module '/var/www/start' #382

Open dhouhamaa opened 4 years ago

dhouhamaa commented 4 years ago

Current behavior

On kubenretes all works fine when using the dev env ( running yarn dev ) but once I change the env variable to production or test , it runs "yarn start" but it is not successfully executed and I get this error although it runs successfully in linux machine and macOS machines.

this

Expected behavior

The service should boot and I should be able to see the application working from the browser on port 3000

Steps to reproduce the issue

By default the env is set to dev and running vue-storefront.sh will run yarn dev successfully . all you need to to is to change the env to test or production for example .

Can you handle fixing this bug by yourself?

NO

Additional information

I can see from this issue that there is also a problem on other machines vuestorefront/vue-storefront#4454 and vuestorefront/vue-storefront-1#349

ShiftyCosmii commented 4 years ago

Have you made sure to run “yarn build” before running “yarn start”. Yarn start requires the build files that are created in var/www/.

It is an honest mistake, but I’m pretty sure that is your issue

dhouhamaa commented 4 years ago

@AntoniErdeg Yes I'am sure am running "yarn build" before "yarn start" because the vue-storefront.sh script runs these commands sequentially when the env is different from dev

gibkigonzo commented 4 years ago

@dhouhamaa did you tried this ecosystem configuration https://github.com/DivanteLtd/vue-storefront/issues/4191#issuecomment-602535658 ?

ShiftyCosmii commented 4 years ago

@dhouhamaa @gibkigonzo I tested this issue on my project. I didn’t encounter any issues. I have no idea problem you’re currently encountering.

If you’re using gitBash - it is because you don’t have the correct permissions for it to start correctly. Linux and Mac Command in-line if you’re the administrator. Automatically, runs the process as administrator.

If you’re using windows. Don’t use gitBash to run “npm start” as it will error. This is due to the permission of .ts executer ts_node as it needs administrator permissions to install and execute correctly.

Try this: Right click on cmd -> run as administrator -> cd (to project path) -> Yarn start (you do still need to ensure you have ran “yarn build” first)

Let me know if that fixes your issue. That was my issue once. Even as the administrator you still will need to run cmd as administrator on windows for it to work correctly. Give that a try for me and let me know how it goes 👍

dhouhamaa commented 4 years ago

@gibkigonzo Yes I did but with no luck @AntoniErdeg Locally in my linux machine all is working fine and yarn start executes successfully but under kubernetes not , and I don't think it is a permission issue in this situation .

hubertinio commented 3 years ago

I have the same issue in docker container.

I solved it - temporary - through new line in package.json "start:production": "cross-env NODE_ENV=production TS_NODE_PROJECT=\"tsconfig-build.json\" node -r ts-node/register ./core/scripts/server",

This is duplicated start:inspect without --inspect flag. Also changed in file /vue-storefront.sh yarn start to yarn start:production