Isuru
Isuru

Reputation: 3958

Vue.js is detected on this page. Devtools inspection is not available because it's in production mode or explicitly disabled by the author

enter image description here

I'm trying to enable vue-devtools in Google Chrome. But I cannot enable it. I'm using vue.js inside the Laravel application.

enter image description here

My server runs using php artisan serve command.

Upvotes: 48

Views: 86138

Answers (15)

binaryfunt
binaryfunt

Reputation: 7127

vite build --mode development

In order to enable Vue devtools for vite build --mode development you need this config:

// vite.config.js
import { defineConfig } from 'vite'

export default defineConfig(({ mode }) => ({
  ...
  define: {
    __VUE_PROD_DEVTOOLS__: mode !== 'production'
  },
}))

See https://vuejs.org/api/compile-time-flags

Upvotes: 10

lpo
lpo

Reputation: 26

For me, using Laravel 11 with Inertia, I was forgetting to run npm run dev.

Upvotes: 0

jeegar
jeegar

Reputation: 1

If you are using the CDN version of Vue, then you need to set the following configuration:

Vue.config.devtools = true;

After running this command, open the browser console and refresh the page. If the Vue DevTools still don't show up, then try clearing the cache in your browser.

Upvotes: 0

Matthis Kohli
Matthis Kohli

Reputation: 1995

If you're using Vite you can configure your environment directory via shared options. If you change that and have NODE_ENV set to production you'll receive this message when trying to inspect your app.

Upvotes: 0

Dach0
Dach0

Reputation: 337

In my case for Laravel 9 fresh installation, I forgot to run sail npm run dev.

Upvotes: 0

Mike
Mike

Reputation: 423

you could try to set environment variable NODE_ENV to 'development' (e.g. set NODE_ENV=development on Windows or export NODE_ENV="development" under Linux) before launching Vue dev server.

Upvotes: 0

Irfandy J.
Irfandy J.

Reputation: 1444

Updated Aug 2022
So apparently as @kissu said, the answer below causes the released code to be an unoptimized one. This might be different than what you want if you want to check production code while being able to check Vue Dev Tools.

Just be aware of it. Unless you don't mind checking the released code in an unoptimized bundle, then the following script is fine. If you don't like the Vue.config.devtools value being static, it might be time to consider env variables or something similar.

Here's how to setup Environtment Variables in Vue


Alternative answer for Vue CLI 3.x
Besides what @NathanWailes has said, this is an alternative which allows the Dev Tools to be available through scripts instead of writing it in your main Vue entry (which is usually main.js or index.js).

You can do this by simply adding this script to package.json

scripts: {
   "start:dev": "vue-cli-service build --mode=development"
}

Explanation
This was because Vue.config.devtools are set to false by default in production mode as said by this GitHub Issue. But this has a work around, simply by using --mode=development flag provided in the documentation.

Then you can run using npm run start:dev and check the file in your dist/ folder! ;)

Upvotes: 10

sunamo.cz
sunamo.cz

Reputation: 69

Just add into vue.config.js:

module.exports = {
  configureWebpack: {
    devtool: 'source-map'
  }
}

delete package-lock.json, node_modules, run npm i and VueJS Devtool will be working

Upvotes: 0

Manu J
Manu J

Reputation: 143

For me Installing latest Vue dev tools - link and enabling 'Allow access to file URLs' in extension settings resolved the issue.

Upvotes: 1

Nathan Wailes
Nathan Wailes

Reputation: 12222

I was seeing the error message in this question's title and this solution worked for me:

Add Vue.config.devtools = true to the file where you create the Vue instance (main.js for me).

Note that, as mentioned in this answer, you need to put the Vue.config.devtools = true line before you create your store in order for the Vuex part of the devtools to work. If you're creating your Vuex store in a separate file (e.g. store.js), you may need to have the Vue.config.devtools = true line in both your main.js file as well as the store.js file.

Below is what the changes looked like in my project: enter image description here enter image description here

Upvotes: 44

KCP
KCP

Reputation: 949

When using Laravel just make sure you run the proper webpack for your environment for development . Running

npm run watch

should build Vue with debug mode on. Using

npm run production

minifies Vue for production. This will save you having to remember to toggle the debug mode when building for production.

Upvotes: 2

zarpio
zarpio

Reputation: 7338

  1. If the page uses a production/minified build of Vue.js, devtools inspection is disabled by default so the Vue pane won't show up.
  2. To make it work for pages opened via file:// protocol, you need to check "Allow access to file URLs" for this extension in Chrome's extension management panel.
  3. I had to restart the chrome, and it worked :-)

Upvotes: 18

bmatovu
bmatovu

Reputation: 4074

If your using CDN; make sure your not using a production (minified) build of the library.

Use: https://unpkg.com/[email protected]/dist/vue.js

Instead of: https://unpkg.com/[email protected]/dist/vue.min.js

You might need to do Ctrl+Alt+I for it to show up the first time. (Source)

Upvotes: 10

Hasnydesign
Hasnydesign

Reputation: 1

make sure you're running a non-production build of Vue.js. https://github.com/vuejs/vue-devtools/issues/62

Upvotes: 0

Allan Karlson
Allan Karlson

Reputation: 499

You may use the dev version of vue.js. For example get it here: https://unpkg.com/[email protected]

Upvotes: 2

Related Questions