medusajs / admin

Admin system for Medusa Stores
https://admin-nu-three.vercel.app
MIT License
431 stars 324 forks source link

Bug: The requested module '/node_modules/.vite/deps/medusa-react.js' does not provide an export named 'useAdminAddLocationToSalesChannel' #924

Open matbrgz opened 1 year ago

matbrgz commented 1 year ago

Hello,

I'm running an application in a Docker container based on the repository https://github.com/medusajs/docker-medusa. After installing the admin module from https://github.com/medusajs/admin, I'm getting the following error:

image

Unexpected Application Error!
The requested module '/node_modules/.vite/deps/medusa-react.js?v=c2e74af3' does not provide an export named 'useAdminAddLocationToSalesChannel'
SyntaxError: The requested module '/node_modules/.vite/deps/medusa-react.js?v=c2e74af3' does not provide an export named 'useAdminAddLocationToSalesChannel'
💿 Hey developer 👋
You can provide a way better UX than this when your app throws errors by providing your own ErrorBoundary prop on <Route>

I've tried cloning the admin repository and using Dockerfile

FROM node:18.15.0
EXPOSE 7000
WORKDIR /app/admin
COPY package*.json ./
RUN rm -rf node_modules
RUN apt-get update
RUN npm install -g npm@latest
COPY . .
RUN npm install --force
RUN npm run build &> /dev/null
COPY develop.sh .
ENTRYPOINT ["./develop.sh", "develop"]

develop.sh

#!/bin/bash

medusa user -e some@email.com -p some-password

npm run $1

Docker Logs

2023-04-06 11:10:11 
2023-04-06 11:10:11 > medusa-admin@0.1.0 develop
2023-04-06 11:10:11 > npm run dev
2023-04-06 11:10:11 
2023-04-06 11:10:11 
2023-04-06 11:10:11 > medusa-admin@0.1.0 dev
2023-04-06 11:10:11 > vite --port 7000 --host
2023-04-06 11:10:11 
2023-04-06 11:10:12 
2023-04-06 11:10:12   VITE v4.2.1  ready in 470 ms
2023-04-06 11:10:12 
2023-04-06 11:10:12   ➜  Local:   http://localhost:7000/
2023-04-06 11:10:12   ➜  Network: http://172.20.0.6:7000/
2023-04-06 11:10:10 ./develop.sh: line 3: medusa: command not found
2023-04-06 11:10:17 2:10:17 PM [vite] error while updating dependencies:
2023-04-06 11:10:17 Error: ENOENT: no such file or directory, rename '/app/admin/node_modules/.vite/deps_temp_943c5659' -> '/app/admin/node_modules/.vite/deps'
2023-04-06 11:10:17     at renameSync (node:fs:1040:3)
2023-04-06 11:10:17     at Object.commit (file:///app/admin/node_modules/vite/dist/node/chunks/dep-79892de8.js:44685:19)
2023-04-06 11:10:17     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-04-06 11:10:17     at async commitProcessing (file:///app/admin/node_modules/vite/dist/node/chunks/dep-79892de8.js:44144:17)
2023-04-06 11:10:17     at async runOptimizer (file:///app/admin/node_modules/vite/dist/node/chunks/dep-79892de8.js:44182:17)

Version:

medusa-starter-default: 0.0.1
Medusa Admin: 0.1.0
Medusa-React: ^4.0.4
Node: LTS 18.15.0
NPM: Latest

I believe there may be a bug with the admin module, and I wanted to report it so it can be fixed. Additionally, I received a suggestion to provide a custom ErrorBoundary prop on to improve the UX when the app throws errors.

Thank you for your attention to this issue.

olivermrbl commented 1 year ago

This project is in maintenance mode and only very critical fixes are attended to. I recommend switching to our new admin system. It should resolve your issues.

SkyLuoPing commented 1 year ago

I also encountered the same issue after installing useAdminAddLocationToSalesChannel Removing the package. json version number and reinstalling it still has the same issue

I would like to replace the Postgres database with MySQL in medusa.comfig.js if configured

SkyLuoPing commented 1 year ago

npm install @medusajs/admin

Still unable to access prompt

Unexpected Application Error! The requested module '/node_modules/.vite/deps/medusa-react.js?v=6c51e4c8' does not provide an export named 'useAdminAddLocationToSalesChannel' SyntaxError: The requested module '/node_modules/.vite/deps/medusa-react.js?v=6c51e4c8' does not provide an export named 'useAdminAddLocationToSalesChannel' 💿 Hey developer 👋

You can provide a way better UX than this when your app throws errors by providing your own errorElement props on

ohmygod481999 commented 1 year ago

In package.json, change version of "medusa-react" to 5.0.0 and install again should solve your problem

SkyLuoPing commented 1 year ago

ohmygod481999: thank you! Dependency package installation solves the problem!!!

How to install the new version of medusa admin UI