commercetools / sunrise-spa

SUNRISE shop template as a single-page application
https://sunrise-spa.now.sh
Apache License 2.0
51 stars 78 forks source link

[Sunrise Spa][Localhost] Demo site doesn't work correctly. #269

Closed tranhoangthien1990 closed 2 years ago

tranhoangthien1990 commented 2 years ago

Hi Team,

Today i tried to set up the Sunrise Spa demo site on my localhost. The homepage looks good, but the add to cart button doens't work and the product detail page don't show anything.

I checked the browser's console and see some warnings and errors related to Vue API and components:

[vue-composition-api] already installed. Vue.use(VueCompositionAPI) should be called only once [Vue warn]: Error in data(): "Error: [vue-composition-api] must call Vue.use(VueCompositionAPI) before using any function." [Vue warn]: Injection "CART" not found [Vue warn]: inject() can only be used inside setup() or functional components. TypeError: Cannot read properties of undefined (reading 'shoppingLists') [Vue warn]: Property or method "totalShoppingCartItems" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties. [Vue warn]: Error in v-on handler (Promise/async): "TypeError: Cannot read properties of undefined (reading 'activeCart')" found in

I'm using the master branch of this repository. NPM version: 8.1.2 Node version: v17.1.0

any advice will be greatly appreciated.

Regards, Thien

harm-meijer commented 2 years ago

Could you not connect to your merchant center project (no .env), restart the project (yarn/npm start) and in the browser console run the following command: localStorage.clear() and then reload the page? You will still have warnings and errors in the console (working on updating packages) but you should be able to see and order products using the default merchant center project.

If you connect to your merchant center project then make sure the config is set up with the right languages, countries and currencies.

harm-meijer commented 2 years ago

@tranhoangthien1990 You may have to install dependencies with yarn install --frozen-lockfile looks like one of the dependencies is broken because a yarn install or update will break the project.