Error Setting up existing Next.js Project

90 Views Asked by At

I'm having trouble setting up a Next.js project locally. The project is about a year old and I just took it over and I'm not particularly fit with next.js projects. The backend of the project is node.js and I already updated the old node 14.x Version to version 18.x

The error when starting the project in the terminal is:

error - pages\index.js (80:17) @ getStaticProps
TypeError: Cannot destructure property 'data' of '(intermediate value)' as it is undefined.
  78 |     const _locale = getStrapiLocale(locale);
  79 |
> 80 |     const {data: macroProductsData} = await client.query({
     |                 ^
  81 |         query: GET_ALL_MACRO_PRODUCTS, variables: {locale: _locale},
  82 |     });
  83 |
Error: Initial locale argument was not passed into serverSideTranslations
    at _callee$ (C:\next-app-main\node_modules\next-i18next\dist\commonjs\serverSideTranslations.js:172:19)
    at tryCatch (C:\next-app-main\node_modules\regenerator-runtime\runtime.js:63:40)
    at Generator.invoke [as _invoke] (C:\next-app-main\node_modules\regenerator-runtime\runtime.js:294:22)
    at Generator.next (C:\next-app-main\node_modules\regenerator-runtime\runtime.js:119:21)
    at asyncGeneratorStep (C:\next-app-main\node_modules\next-i18next\node_modules\@babel\runtime\helpers\asyncToGenerator.js:3:24)
    at _next (C:\next-app-main\node_modules\next-i18next\node_modules\@babel\runtime\helpers\asyncToGenerator.js:25:9)
    at C:\next-app-main\node_modules\next-i18next\node_modules\@babel\runtime\helpers\asyncToGenerator.js:32:7
    at new Promise (<anonymous>)
    at C:\next-app-main\node_modules\next-i18next\node_modules\@babel\runtime\helpers\asyncToGenerator.js:21:12
    at serverSideTranslations (C:\next-app-main\node_modules\next-i18next\dist\commonjs\serverSideTranslations.js:259:17)

The error log on localhost:3000 is:

Server Error
Error: Initial locale argument was not passed into serverSideTranslations

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
_callee$
file:///C:/next-app-main/node_modules/next-i18next/dist/commonjs/serverSideTranslations.js (172:19)
tryCatch
file:///C:/next-app-main/node_modules/regenerator-runtime/runtime.js (63:40)
Generator.invoke [as _invoke]
file:///C:/next-app-main/node_modules/regenerator-runtime/runtime.js (294:22)
Generator.next
file:///C:/next-app-main/node_modules/regenerator-runtime/runtime.js (119:21)
asyncGeneratorStep
file:///C:/next-app-main/node_modules/next-i18next/node_modules/@babel/runtime/helpers/asyncToGenerator.js (3:24)
_next
file:///C:/next-app-main/node_modules/next-i18next/node_modules/@babel/runtime/helpers/asyncToGenerator.js (25:9)
<unknown>
file:///C:/next-app-main/node_modules/next-i18next/node_modules/@babel/runtime/helpers/asyncToGenerator.js (32:7)
new Promise
<anonymous>
<unknown>
file:///C:/next-app-main/node_modules/next-i18next/node_modules/@babel/runtime/helpers/asyncToGenerator.js (21:12)
serverSideTranslations
file:///C:/next-app-main/node_modules/next-i18next/dist/commonjs/serverSideTranslations.js (259:17)

I updated the expired 14.x Node.js Version to Version 18.17.1

0

There are 0 best solutions below