Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'runtimeConfig' does not exist in type 'NuxtConfig'

I'm trying to create a Nuxt 3 project based on installation guide: https://nuxt.com/docs/getting-started/installation. I followed it step by step. But when i want to configure nuxt.config.ts and i paste sample config file from https://nuxt.com/docs/getting-started/configuration:

export default defineNuxtConfig({
  runtimeConfig: {
    // The private keys which are only available server-side
    apiSecret: '123',
    // Keys within public are also exposed client-side
    public: {
      apiBase: '/api'
    }
  }
})

I'm getting a typescript error:

Argument of type '{ runtimeConfig: { apiSecret: string; public: { apiBase: string; }; }; }' is not assignable to parameter of type 'NuxtConfig'.
  Object literal may only specify known properties, and 'runtimeConfig' does not exist in type 'NuxtConfig'.ts(2345)

I'm using node version 16.16.0 and Visual Studio Code is my IDE.

like image 213
voyt97 Avatar asked May 11 '26 10:05

voyt97


1 Answers

I had to update typescript version from 4.7.3 to 5.0.4 and change settings of vsc to use newer version.

like image 125
voyt97 Avatar answered May 14 '26 18:05

voyt97



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!