#Error in deploy

23 messages · Page 1 of 1 (latest)

cunning gazelle
#

Hi, I'm studying the framework and completed the acme-dashboard course.
Excellent stuff by the way, but I can't deploy the finished project to Vercel. I receive the following error in build:

Type error: Cannot find name 'Metadata'.
This is my first contact with Typescript too, but looks like the Metadata type isn't defined, right? Why this error doesn't appear in dev script?

wet sparrowBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

floral quartz
#

Did you try to buildlocally? npm run build

#

should get the same error there

cunning gazelle
#

mmm.. yeah, same problem

floral quartz
#

I didn't do the course but they probably did some setting for the devenvironment to ignore Typescript error to make it easier on the beginners.

You can go two routes:
a): Ignore Typescript errors everywhere (build and dev, local and production). This is obviously not great but since you are learning, you may want to defer Typescript to a later point in time.
In your next.config.js

module.exports = {
  typescript: {
    // !! WARN !!
    // Dangerously allow production builds to successfully complete even if
    // your project has type errors.
    // !! WARN !!
    ignoreBuildErrors: true,
  },
}

I mean you see the warnings. Only for learning purposes not a real production app.

b) Setup something like eslint to get the errors in your IDE (vscode or whatever you use) and fix the Types
Screenshot of a Type Error in vscode:

#

//Edit
Alomost forgot. Your Error particular you most likely just forgot to import the Type "Metadata"
import { type Metadata } from "next"

#

// Edit2:
In general always first build locally (and fix errors) before pushing to Vercel (or whereever you host)

cunning gazelle
#

i'm also using vscode and getting the error in IDE linter.
i don't think it's a good idea ignore errors although I have done it...
The Metadata interface is already imported in app layout

floral quartz
#

you have the error in /dashboard/invoices/[id]/edit/page.tsx

cunning gazelle
#

yes, and in other pages too
but that's how the course teaches
import only in the app layout

floral quartz
#

Hm thats not true give me the link where the course says that maybe you misunderstod

cunning gazelle
#

btw, the metadata pages its fully working on dev script

#

i just cant build

floral quartz
#

yea cause type errors don't stop you in dev

#

would be annyoing if the dev server stops every time you didnt define type (yet)

#

I don't see in the course where it says you only have to import metadata type in the layouts

#

i think you misunderstood something

#

you can use metadata in the layout and every page below it will 'inherit' that meta data that is true

#

but if you define more metadata within a child (like you did) in /dashboard/invoices/[id]/edit/page.tsx you have to import the type there as well

cunning gazelle
#

mm, i assumed wrong