Baroshem / nuxt-medusa

🛍️ Medusa module for Nuxt
https://nuxt-medusa.vercel.app
MIT License
123 stars 9 forks source link

I'm having error though, when running in ssr mode: '[nuxt] [request error] [unhandled] [500] Cannot find module './lib/axios' #31

Closed SaulAbreu closed 8 months ago

SaulAbreu commented 11 months ago

Version

nuxt-medusa nuxt:

Reproduction Link

Steps to reproduce

What is Expected?

What is actually happening?

fsyntax commented 11 months ago

Experiencing the same here on fresh projects. I did notice that the most recent version of the medusa-js client is ^6.0.2 - compared to the version in this module (^1.3.10)

SaulAbreu commented 11 months ago

The error was I set the NITRO PORT to 8000 as env variable in Netlify, when is it not needed.

fsyntax commented 11 months ago

How does that even relate? For me this is happening on a local environment, fresh Nuxt 3 install..

SaulAbreu commented 11 months ago

If this happen on local check in medusa config of the backend the STORE_CORS and set the same port as Nuxt uses. Also set the MEDUSA_URL in the env file to the localhost:9000 by default.

fsyntax commented 11 months ago

Thanks for the advice, but the medusa config itself is fine. When working with the @medusajs/medusa-js client itself, it's working. Hence my note about the client version in the module

dimitrio-m commented 8 months ago

Hello! I'm currently having the same issue after starting a fresh project. I followed this guide and got the same error as the title of the issue. Do you guys know about a workaround or something?

BTW: I am running Nuxt on port 8000 and Medusa API on port 9000 as the default value suggests.

Baroshem commented 8 months ago

Hey,

I have encountered this issue some time ago but now it disapeared and was not occuring anymore. The problem I had was related to client vs browser usage of this package. When I have implemented one solution it was breaking the other one. So I decided to stay with the current one as it was not causing any problems for me. I will reopen this issue and try to experiment in the upcoming days but I will be also working on other packages so if anyone would be up for doing some reasearch please do so :)

dimitrio-m commented 8 months ago

@Baroshem I'm a noob with anything related to open source and npm packaging, but I think it has something to do with the npm package configuration. I tested it locally and it works great. I also linked the module locally from my project and it worked flawlessly. I linked both, the src/module.ts and the dist/module.cjs. I don't know if that is how that is supposed to be tested but it worked.

Note: When I tried to run yarn run prepack without building the playground environment first, it threw some error that said that it couldn't find some typescript configuration files. I don't know if the playground environment should be built before publishing a release or not, but that seemed relevant.

Edit: I will investigate further, if I manage to solve the issue, I will submit a PR :)

Baroshem commented 8 months ago

Hey guys, @dimitrio-m created a PR with a fix (and general refactor - thanks for that! 💚)

Could you check if the error persists on 0.5.0 version?

dimitrio-m commented 8 months ago

Hello @Baroshem ! I'm glad that the PR got merged! I would like to help you maintain this module :smile:

Regarding the fix, I tried importing it in a new project and it worked. I also tried importing it in a new project following the Authoring Nuxt Layers Guide and it worked there too.

Baroshem commented 8 months ago

@dimitrio-m I am more than happy to see that!

Feel free to suggest any changes to the module and lets make it great together! 🚀

Baroshem commented 8 months ago

@SaulAbreu @fsyntax

Could you check if it works right now?

fsyntax commented 8 months ago

@SaulAbreu @fsyntax

Could you check if it works right now?

For me, everything works like a charm now :) Thanks!

evan959 commented 2 months ago

it's not work,this my dependencies

"nuxt": "^3.11.2",
"vue": "^3.4.21",
"vue-router": "^4.3.0"
Baroshem commented 2 months ago

Hey @evan959 could you please create a new issue with reproduction steps or repo?

evan959 commented 2 months ago

ok, @Baroshem I created new issuse, please take a look