Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why console.log dose not working in Vue.js?

Tags:

vue.js

Enviorment

$ node -v
v8.16.2
$ npm -v
6.4.1

    "vue": {
      "version": "2.5.16",
      "resolved": "https://registry.npmjs.org/vue/-/vue-2.5.16.tgz",
      "integrity": "sha512-..."
    },
    "nuxt": {
      "version": "1.4.1",
      "resolved": "https://registry.npmjs.org/nuxt/-/nuxt-1.4.1.tgz",
     ...
    },
    "webpack": {
      "version": "3.12.0",
      "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.12.0.tgz",
    ...
    },
    "uglifyjs-webpack-plugin": {
      "version": "0.4.6",
     ...
    }
<template>
  <div class="container">
    <h2>Complete</h2>
</div>
</template>

<script>
import Vue from 'vue'

export default {
  name: 'NuxtError',
  props: {
    error: {
      type: Object,
      default: null
    }
  },
  created() {
    console.log('created');
    nextUrl = "http://localhost:3000";
    console.log(nextUrl);

    ...
  }
}
</script>


Problem

console.log not working.

Try

  • Search "drop_console" in all source ->none
  • Search "UglifyJsPlugin" in all source →none
  • Write "process.env.DEBUG = 'nuxt:*'" →not working

Wish

Please tell me resolve. Please teach me about require code for ask.

Thank you.

like image 514
Akihiro Seki Avatar asked Jun 14 '26 08:06

Akihiro Seki


1 Answers

ESLint throws the error because it has some rules for the console, so you can try:

/ * eslint-disable no-console * /
console.log ('hello world');

or instead:

window.console.log ('Hello world');

To configure it globally, open package.json and put:

"eslintConfig": {
...
"rules": {
  "no-console": "off"
},

and restart the server.

like image 106
Guillermo Verón Avatar answered Jun 16 '26 02:06

Guillermo Verón



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!