vercel / commerce

Next.js Commerce
https://demo.vercel.store
MIT License
11.17k stars 4.1k forks source link

How to running in localhost? #684

Closed PeaceAntoHim closed 2 years ago

PeaceAntoHim commented 2 years ago

I have to set .env.template to .env.local and than i set the COMMERCE_PROVIDER=shopify. But when i type yarn dev these have something error this a message: error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error Error: The commerce provider "shopify" can't be found, please use one of "@vercel/commerce-local, @vercel/commerce-bigcommerce, @vercel/commerce-saleor, @vercel/commerce-shopify, @vercel/commerce-swell, @vercel/commerce-vendure, @vercel/commerce-ordercloud, @vercel/commerce-kibocommerce, @vercel/commerce-spree, @vercel/commerce-commercejs" at withCommerceConfig (C:\Users\user01\Documents\ecommerce\site\commerce-config.js:51:11)
at Object. (C:\Users\user01\Documents\ecommerce\site\next.config.js:11:18)
at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at ModuleWrap. (node:internal/modules/esm/translators:190:29) at ModuleJob.run (node:internal/modules/esm/module_job:185:25) at async Promise.all (index 0) at async ESMLoader.import (node:internal/modules/esm/loader:281:24) error Command failed with exit code 1.

aubryll commented 2 years ago

Try this https://github.com/vercel/commerce/issues/681#issuecomment-1041921734

PeaceAntoHim commented 2 years ago

Try this #681 (comment)

Hi aubryll but the step you gave to me still does not work. Are that have to change .env.local?

aubryll commented 2 years ago

@PeaceAntoHim my .env.local looks like this?

  # Template to be used for creating .env* files (.env, .env.local etc.) in the project's root directory.

  COMMERCE_PROVIDER=@vercel/commerce-spree

  {# - NEXT_PUBLIC_* are exposed to the web browser and the server #}
  NEXT_PUBLIC_SPREE_API_HOST=localhost:4000
  NEXT_PUBLIC_SPREE_DEFAULT_LOCALE=en-us
  NEXT_PUBLIC_SPREE_CART_COOKIE_NAME=spree_cart_token
  {# -- cookie expire in days #}
  NEXT_PUBLIC_SPREE_CART_COOKIE_EXPIRE=7
  NEXT_PUBLIC_SPREE_USER_COOKIE_NAME=spree_user_token
  NEXT_PUBLIC_SPREE_USER_COOKIE_EXPIRE=7
  NEXT_PUBLIC_SPREE_IMAGE_HOST=localhost:4000
  NEXT_PUBLIC_SPREE_ALLOWED_IMAGE_DOMAIN=localhost:4000
  NEXT_PUBLIC_SPREE_CATEGORIES_TAXONOMY_PERMALINK=categories
  NEXT_PUBLIC_SPREE_BRANDS_TAXONOMY_PERMALINK=brands
  NEXT_PUBLIC_SPREE_ALL_PRODUCTS_TAXONOMY_ID=false
  NEXT_PUBLIC_SPREE_SHOW_SINGLE_VARIANT_OPTIONS=false
  NEXT_PUBLIC_SPREE_LAST_UPDATED_PRODUCTS_PRERENDER_COUNT=10
  NEXT_PUBLIC_SPREE_PRODUCT_PLACEHOLDER_IMAGE_URL=/product-img-placeholder.svg
  NEXT_PUBLIC_SPREE_LINE_ITEM_PLACEHOLDER_IMAGE_URL=/product-img-placeholder.svg
  NEXT_PUBLIC_SPREE_IMAGES_OPTION_FILTER=false
  NEXT_PUBLIC_SPREE_IMAGES_SIZE=1000x1000
  NEXT_PUBLIC_SPREE_IMAGES_QUALITY=100
  NEXT_PUBLIC_SPREE_LOGIN_AFTER_SIGNUP=true
okbel commented 2 years ago

We added more info to the README and after adding the right environment variables (check the .env example) you should just install all with yarn and run yarn dev to develop