13

I am creating a new project using nuxt.js v2.3.0. When I run npm run dev in my IDE console everything compiles correctly but when I go to the page I get the following error: Nuxt.js + Vue.js is detected on this page. Devtools inspection is not available because it's in production mode or explicitly disabled by the author.

Here is my nuxt.config.js file:

const pkg = require('./package');

module.exports = {
  mode: 'spa',

  dev: true,
  /*
  ** Headers of the page
  */
  head: {
    title: pkg.name,
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: pkg.description }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ],
    bodyAttrs: {
      class: 'h-100'
    },
    htmlAttrs: {
      class: 'h-100'
    }
  },

  /*
  ** Global CSS
  */
  css: [
    '@/assets/app.css'
  ],

  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
    '~/plugins/vue-notifications',
    '~/plugins/vue2-sidebar'
  ],

  /*
  ** Nuxt.js modules
  */
  modules: [
    // Doc: https://github.com/nuxt-community/axios-module#usage
    '@nuxtjs/axios',
    // Doc: https://bootstrap-vue.js.org/docs/
    'bootstrap-vue/nuxt',
    // Doc: https://auth.nuxtjs.org/getting-starterd/setup
    '@nuxtjs/auth',
    '@nuxtjs/toast',
    '@nuxtjs/font-awesome'
  ],
  /*
  ** Axios module configuration
  */
  axios: {
    baseURL: 'http://users:8000'
  },

  /*
  ** Auth module configuration
  */
  auth: {
    strategies: {
      password_grant: {
        _scheme: 'local',
        endpoints: {
          login: {
            url: '/oauth/token',
            method: 'post',
            propertyName: 'access_token'
          },
          logout: 'api/logout',
          user: {
            url: 'api/user',
            method: 'get',
            propertyName: false
          },
        },
        tokenRequired: true,
        tokenType: 'Bearer'
      }
    },
    redirect: {
      login: "/account/login",
      logout: "/",
      callback: "/account/login",
      user: "/"
    },
  },

  /*
  ** Toast configuration
  */
  toast: {
    position: 'top-right',
    duration: 2000
  },


  loading: {
    name: 'chasing-dots',
    color: '#ff5638',
    background: 'white',
    height: '4px'
  },

  /*
  ** Router configuration
  */
  router: {
    middleware: ['auth']
  },

  /*
  ** Build configuration
  */
  build: {
    /*
    ** You can extend webpack config here
    */
    extend(config, ctx) {

    }
  }
};

If I was running in production mode then I could understand but I'm not. I would expect vue-devtools to be running as normal.

kissu
  • 40,416
  • 14
  • 65
  • 133
joshua jackson
  • 629
  • 1
  • 6
  • 17

6 Answers6

29

I had to add the following to the nuxt.config.js:

vue: {
  config: {
    productionTip: false,
    devtools: true
  }
}

Now devtools shows up

kissu
  • 40,416
  • 14
  • 65
  • 133
joshua jackson
  • 629
  • 1
  • 6
  • 17
  • 14
    What version were you running when this worked? I'm on the latest v2.4.5 and had no luck. https://nuxtjs.org/api/configuration-build#devtools indicates we should be able to set `devtools` to `true` in the build config but that doesn't work for me either (nor in combination with this). – Christopher Mar 09 '19 at 05:25
5

tl:dr:

  • vue.config.devtools = true in my nuxt.config.js does not work for me.
  • I ran nuxt generate --devtools, then nuxt start and opened the website in my browser. Doing so I could use the Vue-Devtools.
  • After that I now can still use the Vue-Devtools, even when running nuxt dev and no vue.config.devtools flag set in my nuxt.config.js

Full story

So enabling the devtools flag in vue.config as in the accepted answer did not work for me either.

I first tried forcing the Vue-Devtools as described here. Adding a Plugin to set the window properties as described in the link. But without luck.

Digging in the Nuxt code I noticed the --devtools flag for the generate command and wanted to see if the Vue-Devtools work at all with Nuxt.

After running nuxt generate --devtools, then serving the application with nuxt start, I finally could access the devtools.
And now, even when running nuxt dev they are still accessible. And I don't have vue.config.devtools set at all in my nuxt.config.js. Weird. But maybe that helps someone.

More context: I am running Nuxt in spa mode, with target static as I don't have a Node server in the Backend and just want to build an SPA.

Jan-Luca Klees
  • 516
  • 4
  • 8
3

As @joshua jackson stated worked for me, while devtools: true did NOT.

Version:

Nuxt.js v2.10.0

Vue v2.6.10

vue: {
  config: {
    productionTip: false,
    devtools: true
  }
}
kissu
  • 40,416
  • 14
  • 65
  • 133
Despertaweb
  • 1,672
  • 21
  • 29
2

in nuxt.config.js

export default {
  mode: 'universal',
  devtools: true,

  ...
}

Hope this help someone stopped here.

kissu
  • 40,416
  • 14
  • 65
  • 133
herla
  • 29
  • 1
0

For me, setting vue.config.devtools = true in nuxt.config.js didn't work. But I managed to solve it by going to

  • Extensions
  • three dots on the right of the vue dev tools extension
  • manage extensions
  • Turn on "Allow access to file URLs"
  • Restart browser and thats it

Hope it helps :)

-1

I have struggled to get this working and tried all of the steps written here.

My issue was I had to run the server on a specified port.

server: {
  port: process.env.PORT || 5000,
  host: '0.0.0.0'
},

Adding this to nuxt.config.js solved the problem.

kissu
  • 40,416
  • 14
  • 65
  • 133
dignitas
  • 65
  • 1
  • 7
  • to add to this, if you force a different port without specifying it in nuxt config as shown above it will always struggle to load dev tools. Keeping it on 3000 has always worked best for me – Titan Apr 04 '21 at 19:47