medusajs / nextjs-starter-medusa

A performant frontend ecommerce starter template with Next.js 15 and Medusa.
https://next.medusajs.com/
MIT License
1.81k stars 506 forks source link

Build error for Next.js Starter Storefront (axios-fetch-adapter) #264

Closed jmc37-sif closed 9 months ago

jmc37-sif commented 9 months ago

Running a fresh build of Medusa using "npx create-medusa-app@latest" and when running "npm run build" I receive multiple module not found errors relating to "axios fetch adapter". Using Medusa version 1.20.

Failed to compile.

./node_modules/@vespaiach/axios-fetch-adapter/index.js Module not found: Package path ./lib/core/settle is not exported from package C:\Users\josep\Desktop\MedusaProductionApplication\sif-medusa-production-storefront\node_modules\axios (see exports field in C:\Users\josep\Desktop\MedusaProductionApplication\sif-medusa-production-storefront\node_modules\axios\package.json)

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module: ./src/lib/config.ts ./src/lib/data/index.ts ./src/app/actions.ts ./node_modules/next/dist/build/webpack/loaders/next-flight-action-entry-loader.js?actions=%5B%5B%22C%3A%5C%5CUsers%5C%5Cjosep%5C%5CDesktop%5C%5CMedusaProductionApplication%5C%5Csif-medusa-production-storefront%5C%5Csrc%5C%5Capp%5C%5Cactions.ts%22%2C%5B%22resetOnboardingState%22%2C%22updateRegion%22%5D%5D%5D&__client_imported__=true!

./node_modules/@vespaiach/axios-fetch-adapter/index.js Module not found: Package path ./lib/helpers/buildURL is not exported from package C:\Users\josep\Desktop\MedusaProductionApplication\sif-medusa-production-storefront\node_modules\axios (see exports field in C:\Users\josep\Desktop\MedusaProductionApplication\sif-medusa-production-storefront\node_modules\axios\package.json)

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module: ./src/lib/config.ts ./src/lib/data/index.ts ./src/app/actions.ts ./node_modules/next/dist/build/webpack/loaders/next-flight-action-entry-loader.js?actions=%5B%5B%22C%3A%5C%5CUsers%5C%5Cjosep%5C%5CDesktop%5C%5CMedusaProductionApplication%5C%5Csif-medusa-production-storefront%5C%5Csrc%5C%5Capp%5C%5Cactions.ts%22%2C%5B%22resetOnboardingState%22%2C%22updateRegion%22%5D%5D%5D&__client_imported__=true!

./node_modules/@vespaiach/axios-fetch-adapter/index.js Module not found: Package path ./lib/core/buildFullPath is not exported from package C:\Users\josep\Desktop\MedusaProductionApplication\sif-medusa-production-storefront\node_modules\axios (see exports field in C:\Users\josep\Desktop\MedusaProductionApplication\sif-medusa-production-storefront\node_modules\axios\package.json)

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module: ./src/lib/config.ts ./src/lib/data/index.ts ./src/app/actions.ts ./node_modules/next/dist/build/webpack/loaders/next-flight-action-entry-loader.js?actions=%5B%5B%22C%3A%5C%5CUsers%5C%5Cjosep%5C%5CDesktop%5C%5CMedusaProductionApplication%5C%5Csif-medusa-production-storefront%5C%5Csrc%5C%5Capp%5C%5Cactions.ts%22%2C%5B%22resetOnboardingState%22%2C%22updateRegion%22%5D%5D%5D&__client_imported__=true!

./node_modules/@vespaiach/axios-fetch-adapter/index.js Module not found: Package path ./lib/utils is not exported from package C:\Users\josep\Desktop\MedusaProductionApplication\sif-medusa-production-storefront\node_modules\axios (see exports field in C:\Users\josep\Desktop\MedusaProductionApplication\sif-medusa-production-storefront\node_modules\axios\package.json)

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module: ./src/lib/config.ts ./src/lib/data/index.ts ./src/app/actions.ts ./node_modules/next/dist/build/webpack/loaders/next-flight-action-entry-loader.js?actions=%5B%5B%22C%3A%5C%5CUsers%5C%5Cjosep%5C%5CDesktop%5C%5CMedusaProductionApplication%5C%5Csif-medusa-production-storefront%5C%5Csrc%5C%5Capp%5C%5Cactions.ts%22%2C%5B%22resetOnboardingState%22%2C%22updateRegion%22%5D%5D%5D&__client_imported__=true!

./node_modules/@vespaiach/axios-fetch-adapter/index.js Module not found: Package path ./lib/core/settle is not exported from package C:\Users\josep\Desktop\MedusaProductionApplication\sif-medusa-production-storefront\node_modules\axios (see exports field in C:\Users\josep\Desktop\MedusaProductionApplication\sif-medusa-production-storefront\node_modules\axios\package.json)

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module: ./src/lib/config.ts ./src/lib/data/index.ts ./src/app/[countryCode]/(main)/page.tsx

Build failed because of webpack errors

I also noticed this in src\lib\config.ts: image

VariableVic commented 9 months ago

Thanks for letting me know! Looks like there's a dependency issue, I'm looking into it.

VariableVic commented 9 months ago

Looks like this was caused by an Axios version mismatch between the fetch adapter and our JS client. I've removed the adapter for now as it's not crucial. Should be solved with the linked PR. Let me know if you're still experiencing issues after this!