我正在使用nuxt.js v2.3.0创建一个新项目。当我在IDE控制台中运行npm run dev时,所有的编译都是正确的,但是当我转到页面时,我得到了以下错误: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.
这是我的nuxt.config.js文件:
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) {
}
}
};如果我是在生产模式,那么我可以理解,但我不是。我希望vue-devtools能正常运行。
发布于 2018-11-17 12:43:40
我不得不在nuxt.config.js中添加以下内容:
vue: {
config: {
productionTip: false,
devtools: true
}
}现在devtools出现了
发布于 2020-10-09 10:08:45
tl:dr:
vue.config.devtools = true在我的nuxt.config.js不适用于我。nuxt generate --devtools,然后运行了nuxt start,并在浏览器中打开了网站。这样我就可以用Vue-Devtools了。nuxt dev并且没有在vue.config.devtools中设置nuxt.config.js标志时也是如此。全故事
因此,在vue.config中启用vue.config标志,就像在接受答案中一样,对我也不起作用。
我第一次尝试强迫Vue-Devtools就像描述这里那样。添加一个插件来设置链接中描述的window属性。但没有运气。
深入研究Nuxt代码,我注意到了generate命令的generate标志,并想看看Vue-Devtools是否与Nuxt一起工作。
在运行nuxt generate --devtools,然后使用nuxt start为应用程序提供服务之后,我终于可以访问devtools了。
现在,即使在运行nuxt dev时,它们仍然是可访问的。我的nuxt.config.js里根本没有设置nuxt.config.js。真奇怪。但也许这能帮上忙。
更多上下文:我在spa模式下运行Nuxt,目标static,因为后端没有节点服务器,只想构建SPA。
发布于 2020-06-29 04:44:50
在nuxt.config.js中
export default {
mode: 'universal',
devtools: true,
...
}希望这能帮到有人停在这里。
https://stackoverflow.com/questions/53346558
复制相似问题