Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run storefront in production because of build errors #7571

Closed
2 tasks
AwaaX opened this issue May 31, 2024 · 8 comments
Closed
2 tasks

Unable to run storefront in production because of build errors #7571

AwaaX opened this issue May 31, 2024 · 8 comments

Comments

@AwaaX
Copy link

AwaaX commented May 31, 2024

Preliminary Checks

Issue Summary

I get type error "Type error: Unused '@ts-expect-error' directive." when trying to run build so i can't use storefront in production mode

How can this issue be resolved?

No idea

Are you interested in working on this issue? Sorry I'm not a developer I am a e-commerce company holder testing medusa

  • I would like to fix this issue
@sradevski
Copy link
Member

sradevski commented Jun 3, 2024

@AwaaX I can build the project without issues. Can you please provide more information to reproduce the issue from a clean clone? What command did you run? Are you running main? What is your node/yarn version?

What are you trying to run, the starter project?

@matmar10
Copy link

matmar10 commented Jun 12, 2024

@sradevski I am also facing this issue with a completely clean (out of the box) install.

I have created a clean install that replicates the issue here: matmar10/medusa-storefront

Steps to reproduce:

This is using Node v20.12.2

  1. npx create-next-app -e https://github.com/medusajs/nextjs-starter-medusa my-medusa-storefront
  2. cd my-medusa-storefront
  3. npm run build

Expected behavior:

  1. Project builds okay out of the box -or-
  2. Removing the @ts-expect-error allows to build

Actual behavior

./src/modules/products/components/product-tabs/accordion.tsx:57:8
Type error: Unused '@ts-expect-error' directive.

  55 |       )}
  56 |     >
> 57 |       {/* @ts-expect-error */}
     |        ^
  58 |       <AccordionPrimitive.Header className="px-1">
  59 |         <div className="flex flex-col">
  60 |           <div className="flex w-full items-center justify-between">

Screenshot 2024-06-12 at 2 53 11 PM

Work-Around / Fix

You can resolve the issue by leaving the first @ts-expect-error and removing the remaining ones:

diff --git a/src/modules/products/components/product-tabs/accordion.tsx b/src/modules/products/components/product-tabs/accordion.tsx
index db8855a..03d837a 100644
--- a/src/modules/products/components/product-tabs/accordion.tsx
+++ b/src/modules/products/components/product-tabs/accordion.tsx
@@ -54,14 +54,12 @@ const Item: React.FC<AccordionItemProps> = ({
         className
       )}
     >
-      {/* @ts-expect-error */}
       <AccordionPrimitive.Header className="px-1">
         <div className="flex flex-col">
           <div className="flex w-full items-center justify-between">
             <div className="flex items-center gap-4">
               <Text className="text-ui-fg-subtle text-sm">{title}</Text>
             </div>
-            {/* @ts-expect-error */}
             <AccordionPrimitive.Trigger>
               {customTrigger || <MorphingTrigger />}
             </AccordionPrimitive.Trigger>
@@ -73,7 +71,6 @@ const Item: React.FC<AccordionItemProps> = ({
           )}
         </div>
       </AccordionPrimitive.Header>
-      {/* @ts-expect-error */}
       <AccordionPrimitive.Content
         forceMount={forceMountContent}
         className={clx(

@andresrivero
Copy link

I had this error as well with npm, I tried the fix above but got a different error - tried adding @medusajs/types but no luck.

I deleted my .node-modules and then used yarn, yarn dev, and yarn build - it ran successfully and built the next app

@santiblanko
Copy link

same here with node 20

@AwaaX
Copy link
Author

AwaaX commented Jul 23, 2024

@AwaaX I can build the project without issues. Can you please provide more information to reproduce the issue from a clean clone? What command did you run? Are you running main? What is your node/yarn version?

What are you trying to run, the starter project?

I do npx create-next-app -e https://github.com/medusajs/nextjs-starter-medusa my-medusa-storefront
then npm run build

node -v
v20.15.1

npm -v
10.7.0

@sradevski I am also facing this issue with a completely clean (out of the box) install.

I have created a clean install that replicates the issue here: matmar10/medusa-storefront

Steps to reproduce:

This is using Node v20.12.2

1. `npx create-next-app -e https://github.com/medusajs/nextjs-starter-medusa my-medusa-storefront`

2. `cd my-medusa-storefront`

3. `npm run build`

Expected behavior:

1. Project builds okay out of the box -or-

2. Removing the `@ts-expect-error` allows to build

Actual behavior

./src/modules/products/components/product-tabs/accordion.tsx:57:8
Type error: Unused '@ts-expect-error' directive.

  55 |       )}
  56 |     >
> 57 |       {/* @ts-expect-error */}
     |        ^
  58 |       <AccordionPrimitive.Header className="px-1">
  59 |         <div className="flex flex-col">
  60 |           <div className="flex w-full items-center justify-between">

Screenshot 2024-06-12 at 2 53 11 PM

Work-Around / Fix

You can resolve the issue by leaving the first @ts-expect-error and removing the remaining ones:

diff --git a/src/modules/products/components/product-tabs/accordion.tsx b/src/modules/products/components/product-tabs/accordion.tsx
index db8855a..03d837a 100644
--- a/src/modules/products/components/product-tabs/accordion.tsx
+++ b/src/modules/products/components/product-tabs/accordion.tsx
@@ -54,14 +54,12 @@ const Item: React.FC<AccordionItemProps> = ({
         className
       )}
     >
-      {/* @ts-expect-error */}
       <AccordionPrimitive.Header className="px-1">
         <div className="flex flex-col">
           <div className="flex w-full items-center justify-between">
             <div className="flex items-center gap-4">
               <Text className="text-ui-fg-subtle text-sm">{title}</Text>
             </div>
-            {/* @ts-expect-error */}
             <AccordionPrimitive.Trigger>
               {customTrigger || <MorphingTrigger />}
             </AccordionPrimitive.Trigger>
@@ -73,7 +71,6 @@ const Item: React.FC<AccordionItemProps> = ({
           )}
         </div>
       </AccordionPrimitive.Header>
-      {/* @ts-expect-error */}
       <AccordionPrimitive.Content
         forceMount={forceMountContent}
         className={clx(

Thanks, you should edit : Keep the two firsts: one line 30 , one line 48 **

after it work

@zaheerahmad33
Copy link

same here with node 18.20.4

Copy link
Contributor

github-actions bot commented Oct 7, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 3 days.

@github-actions github-actions bot added the Stale label Oct 7, 2024
Copy link
Contributor

This issue was closed because it has been stalled for 3 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants