-
SummaryI tried to host NEXT JS project on vercel with github repo. I followed the tutorials from NEXT JS official sites but seeing this error message. ( Type error: Cannot find module '@/app/ui/fonts' or its corresponding type declarations. Additional information1 | import { GlobeAltIcon } from '@heroicons/react/24/outline';
> 2 | import { lusitana } from '@/app/ui/fonts';
| ^
3 |
4 | export default function AcmeLogo() {
5 | return (
Error: Command "npm run build" exited with 1 ) Examplehttps://vercel.com/schlinks-projects/nextjs-dashboard/A9ooANdwGFCA1nLFQ8ZHZC2tvZMe |
Beta Was this translation helpful? Give feedback.
Replies: 11 comments 32 replies
-
Hi! Could you show your |
Beta Was this translation helpful? Give feedback.
-
This fix worked for me. It should be mentioned in the official Vercel NextJS Tutorial | Chapter 6.
|
Beta Was this translation helpful? Give feedback.
-
If nothing works , do check the file name for the fonts.tsx you create . I missed 's' and everywhere i was importing the wrong filename. |
Beta Was this translation helpful? Give feedback.
-
I ran into an error here because I skipped Chapter 3 folks! |
Beta Was this translation helpful? Give feedback.
-
In my case I was getting this error because I decided to build the project before completing the first part of the tutorial. This file dashboard/final-example/app/ui/fonts.ts was missing and I now realize that it was intended to be created in a later stage in the tutorial. |
Beta Was this translation helpful? Give feedback.
-
i have problem this problem so: Failed to compile. -- 16:57:29.215 | 16:57:29.215 | ./app/ui/acme-logo.tsx:2:26 16:57:29.215 | Type error: Cannot find module '@/app/ui/fonts' or its corresponding type declarations. 16:57:29.216 | 16:57:29.216 | 1 \| import { GlobeAltIcon } from '@heroicons/react/24/outline'; 16:57:29.216 | > 2 \| import { lusitana } from '@/app/ui/fonts'; 16:57:29.216 | \| ^ 16:57:29.216 | 3 \| 16:57:29.216 | 4 \| export default function AcmeLogo() { 16:57:29.218 | 5 \| return ( 16:57:29.277 | Error: Command "npm run build" exited with 1 ------------------- But I noticed that the changes that I make in my code in Visual Studio or GitHub directly, are not given in the Versel code. delete yout project in vercel and then reinstall new project from corrected github files. |
Beta Was this translation helpful? Give feedback.
-
You may need to install the package google fonts. |
Beta Was this translation helpful? Give feedback.
-
Created a pull request to avoid future users running into this issue vercel/next-learn#674 |
Beta Was this translation helpful? Give feedback.
-
please fix example app project or, better, add a few lines to the documentations of learning project to help newbies to find and fix this error. |
Beta Was this translation helpful? Give feedback.
-
In next 14, you can see vercel/next-learn#580 (comment), I have solved the problem.😊 |
Beta Was this translation helpful? Give feedback.
-
Just create a file in '@/app/ui' name "fonts.ts" and then add:
|
Beta Was this translation helpful? Give feedback.
Okay! So let's start defining the
baseUrl
and thepaths
in the tsconfig as you can see in my previous answer! You can define:And see if it works for you already!