Open fatihcaliss opened 1 year ago
I tried with node 18 latest version and it works
Could you write exact node version? Is it 18.12.1?
Could you write exact node version? Is it 18.12.1?
Hello, I also got the same issue. My node version is 18.12.1.
I need help with this too
With the nextjs frontend regarding the strapi/next blog, you have to use node 16.14.0 and also use yarn (I use yarn 1.22.19).
I'll wait a patch for strapi starter next-blog. This one doesn't work with node 18.12.1 and yarn .1.22.19. Tomorrow I'll try with node 16.14.0, are you sure it works with this version? @massweb58
Yes it works fine with nodejs 16.14.0. FYI, the blog with Gatsby and STrapi works with the latest version of nodejs 18.x.x
I have just done... I confirm it works with node@16.14.0. Thanks @massweb58
Can't get next-corporate
to work with Node 16.14.0 or any other node version. It's amazing that none of the starters, the front door for Strapi, the one thing that all new Strapi developers are encouraged to try, all completely fail. next-corporate
with Javascript goes through the installer but fails at runtime. next-corporate
with Typescript fails at install time. The only starter that works is next-blog
.
MacOS 12.6.1 Now using node v16.14.0 (npm v8.3.1) me@localhost frontend % npm run develop
my-next-corporate@1.0.7 develop next
ready - started server on 0.0.0.0:3000, url: http://localhost:3000 info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5 event - compiled successfully event - build page: /[[...slug]] wait - compiling... event - compiled successfully event - build page: /next/dist/pages/_error wait - compiling... event - compiled successfully error - pages/_app.js (17:10) @ MyApp TypeError: Cannot destructure property 'metadata' of 'global.attributes' as it is undefined. 15 | } 16 |
17 | const { metadata, favicon, metaTitleSuffix } = global.attributes | ^ 18 | 19 | return ( 20 | <> TypeError: Cannot read properties of undefined (reading 'global') at getGlobalData (webpack-internal:///./utils/api.js:361:22) at processTicksAndRejections (node:internal/process/task_queues:96:5)
These are my fixes:
frontend/utils/api.js
export async function getGlobalData(locale) {
...
const global = await globalRes.json()
// you may add this block if you wish to see the error message
if ( global.errors ) {
global.errors.forEach( e => console.log(e.message));
}
return global.data?.global.data; // <-- here
}
frontend/pages/_app.js
const MyApp = ({ Component, pageProps }) => {
// Extract the data we need
const { global } = pageProps
// add following block!
if ( ! global ) {
return <ErrorPage statusCode={404} />
}
...
frontend/pages/[[...slug]].js
export async function getStaticProps(context) {
...
return {
props: {
preview,
sections: contentSections,
metadata,
global: globalLocale, // <-- here! remove .attributes
pageContext: {
...pageContext,
localizedPaths,
},
},
}
}
Ensure that you have all 'Global' content created with all fields on the back-end.
After command used:
npx create-strapi-starter mysite3 next-corporate
Backend installed and run successfully but frontend did not. I'm getting this error:
TypeError: Cannot destructure property 'metadata' of 'global.attributes' as it is undefined.
Anyone can help me with this issue? regards,