styxlab / next-cms-ghost

Publish flaring fast blogs with Next.js and Ghost CMS
https://next.jamify.org
MIT License
672 stars 205 forks source link

Build error occurred ReferenceError: Cannot access 'api' before init #193

Open stelasido opened 1 year ago

stelasido commented 1 year ago

npm i yarn

npm run build yarn build

and that error: ` 1:/var/www/blog/next-cms-ghost$ npm run build

next-cms-ghost@1.0.0 build next build

info - Loaded env from /var/www/blog/next-cms-ghost/.env.local info - Checking validity of types
info - Creating an optimized production build
info - Compiled successfully

Build error occurred ReferenceError: Cannot access 'api' before initialization at getAllPosts (/var/www/blog/next-cms-ghost/.next/server/chunks/393.js:454:19) at getStaticPaths (/var/www/blog/next-cms-ghost/.next/server/pages/[...slug].js:1591:90) at buildStaticPaths (/var/www/blog/next-cms-ghost/node_modules/next/dist/build/utils.js:498:37) at /var/www/blog/next-cms-ghost/node_modules/next/dist/build/utils.js:641:125 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Span.traceAsyncFn (/var/www/blog/next-cms-ghost/node_modules/next/dist/trace/trace.js:75:20) { type: 'ReferenceError' }`

`lsb_release -a

Distributor ID: Ubuntu Description: Ubuntu 22.04.2 LTS Release: 22.04

NVM with a supported for GhostCMS version 18.6 or above, it doesn't matter.

.env.local: CMS_GHOST_API_URL=...... CMS_GHOST_API_KEY=......

deelo55 commented 5 months ago

I'm getting the same