i have a project and i have hosted it netlify at begining its working fine and later some days i have added more content in website and again pushed the code into github and automatically netlify project is also will update the code and will show but its not showing and after adding some more data when i look in to netlify its getting building failed i don’t know what’s going on i tried to solve all the way posible and corrected all the errors but its again showing the same problem below im pasting the error what it’s saying i have tried all those things once check it out.
Diagnosis:
In the build logs at line 88, it mentions a type error related to the default export in the file “app/destinationApi/page.js”. The error specifies that the type “{ destination: any; }” is not valid.
Solution:
To resolve this error, you need to ensure that the default export in “app/destinationApi/page.js” conforms to the correct type. Update the default export in that file to the appropriate type to fix this issue.
12:39:41 PM: Netlify Build
12:39:41 PM: ────────────────────────────────────────────────────────────────
12:39:41 PM:
12:39:41 PM: ❯ Version
12:39:41 PM: @netlify/build 29.50.5
12:39:41 PM:
12:39:41 PM: ❯ Flags
12:39:41 PM: baseRelDir: true
12:39:41 PM: buildId: 6694ca7a2cfa680d0cd8e682
12:39:41 PM: deployId: 6694ca7a2cfa680d0cd8e684
12:39:41 PM:
12:39:41 PM: ❯ Current directory
12:39:41 PM: /opt/build/repo
12:39:41 PM:
12:39:41 PM: ❯ Config file
12:39:41 PM: No config file was defined: using default values.
12:39:41 PM:
12:39:41 PM: ❯ Context
12:39:41 PM: production
12:39:42 PM:
12:39:42 PM: ❯ Using Next.js Runtime - v5.5.1
12:39:43 PM: No Next.js cache to restore
12:39:43 PM:
12:39:43 PM: Build command from Netlify app
12:39:43 PM: ────────────────────────────────────────────────────────────────
12:39:43 PM:
12:39:43 PM: $ npm run build
12:39:43 PM: > [email protected] build
12:39:43 PM: > next build
12:39:44 PM: ⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
12:39:44 PM: ▲ Next.js 14.2.5
12:39:44 PM: Creating an optimized production build ...
12:39:46 PM: ⚠ For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'npm i sharp', and Next.js will use it automatically for Image Optimization.
12:39:46 PM: Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
12:39:57 PM: ⚠ For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'npm i sharp', and Next.js will use it automatically for Image Optimization.
12:39:57 PM: Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
12:40:05 PM: ✓ Compiled successfully
12:40:05 PM: Linting and checking validity of types ...
12:40:07 PM: Failed to compile.
12:40:07 PM:
12:40:07 PM: app/destinationApi/page.js
12:40:07 PM: Type error: Page "app/destinationApi/page.js" has an invalid "default" export:
12:40:07 PM: Type "{ destination: any; }" is not valid.
12:40:07 PM:
12:40:07 PM: "build.command" failed
12:40:07 PM: ────────────────────────────────────────────────────────────────
12:40:07 PM:
12:40:07 PM: Error message
12:40:07 PM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
12:40:07 PM:
12:40:07 PM: Error location
12:40:07 PM: In Build command from Netlify app:
12:40:07 PM: npm run build
12:40:07 PM:
12:40:07 PM: Resolved config
12:40:07 PM: build:
12:40:07 PM: command: npm run build
12:40:07 PM: commandOrigin: ui
12:40:07 PM: publish: /opt/build/repo/.next
12:40:07 PM: publishOrigin: ui
12:40:07 PM: plugins:
12:40:07 PM: - inputs: {}
12:40:07 PM: origin: ui
12:40:07 PM: package: '@netlify/plugin-nextjs'
12:40:07 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:40:08 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
12:40:08 PM: Failing build: Failed to build site
12:40:08 PM: Finished processing build request in 46.303s
I have tried many things like installing packages and changed the import and export lines but not working and i want to fix this issue and i can able to host the project again without any problem.
Mohammed Zaheer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.