Vue-cli: Lint task fails in Vue UI [invalid options in vue.config.js: "assetsDir" is not allowed to be empty]

Created on 13 Sep 2018  路  13Comments  路  Source: vuejs/vue-cli

Version

3.0.3

Node and OS info

Node v8.10.0 / yarn 1.9.4 / macOS High Sierra 10.13.6

Steps to reproduce

  • Run vue ui.
  • Go to your project.
  • Go to tasks.
  • Run lint task.

What is expected?

Linter errors.

What is actually happening?

The output show next error a lot of times:

ERROR Invalid options in vue.config.js: child "assetsDir" fails because ["assetsDir" is not allowed to be empty]

bug ui

All 13 comments

Please, do provide a reproduction.

What's in your vue.config.js?

vue.config.js

module.exports = {
    lintOnSave: false,

    pluginOptions: {
        i18n: {
            locale: 'es',
            fallbackLocale: 'es',
            localeDir: 'locales',
            enableInSFC: false
        }
    },
    baseUrl: './'
}

.eslintrc

{
    "root": true,
    "env": {
        "node": true
    },
    "extends": ["@vue/eslint-config-airbnb", "plugin:vue/recommended", "@vue/standard", "plugin:vue-types/strongly-recommended"],
    "rules": {
        "vue/html-closing-bracket-newline": [
            "error",
            {
                "singleline": "never",
                "multiline": "always"
            }
        ],
        "vue/html-indent": [
            "error",
            4,
            {
                "attribute": 1,
                "closeBracket": 0,
                "alignAttributesVertically": true,
                "ignores": []
            }
        ],
        "object-curly-spacing": ["error", "always"],
        "semi": ["error", "never"],
        "max-len": [
            "error",
            {
                "comments": 180,
                "code": 180
            }
        ],
        "indent": [
            "error",
            4,
            {
                "SwitchCase": 1,
                "VariableDeclarator": 1,
                "outerIIFEBody": 1
            }
        ],
        "vue/html-closing-bracket-spacing": "error",
        "vue/prop-name-casing": "error"
    },
    "parserOptions": {
        "parser": "babel-eslint"
    }
}

Can't reproduce. There's no assetsDir in your vue.config.js. No idea where the error is from.

I had the same issue a few days ago!
Only way to get rid of the error was to actually define assetsDir, if I removed it again, the error reappeared. Then a day later or so, I removed assetsDir and somehow it still worked, error was gone.
Still non the wiser about what causes it, though :(

Hi!

Today, it's working for me, last week don't. I don't understand it... It's very weird, I haven't changed anything.

thanks!

Got this too, same process as OP to reproduce.

same issue锛宱nly when running lint task in ui, npx vue-cli-service lint always works well.
I have this config to make eslint work with webpack alias, ui lint task works well when it's removed

  settings: {
    'import/resolver': {
      webpack: {
        config: path.resolve(__dirname, 'node_modules/@vue/cli-service/webpack.config.js'),
      },
    },
  },

here's my vue.config.js

const path = require('path');
const fs = require('fs');

module.exports = {
  configureWebpack: {
    resolve: {
      alias: {
        vue$: 'vue/dist/vue.esm.js',
        '@': resolve('src'),
        _index: resolve('src/pages/index'),
        _acti: resolve('src/pages/activity'),
      },
    },
  },
  css: {
    loaderOptions: {
      sass: {
        data: fs.readFileSync(path.join(__dirname, './src/assets/style/variables.scss'), 'utf8'),
      },
    },
  },
  devServer: {
    proxy: {
      '/api': {
        target: 'http://localhost:8666',
        pathRewrite: {
          '^/api': '/api',
        },
      },
    },
  },
};

@sodatea reproduce repo https://github.com/FFxSquall/vue-ui-bug

I have the same issue, how to fix?

@imudin It's fixed in @vue/cli v3.1.3

@sodatea Thanks I thought the latest one is 3.1.1

@sodatea Still happening in version 3.1.3

@sodatea it is working well after updating @vue/cli-plugin-eslint, @vue/cli-service and dev dependencies related to eslint. Now output is showing real issue in my code instead of long webpack error issue. Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

csakis picture csakis  路  3Comments

DrSensor picture DrSensor  路  3Comments

Gonzalo2683 picture Gonzalo2683  路  3Comments

eladcandroid picture eladcandroid  路  3Comments

OmgImAlexis picture OmgImAlexis  路  3Comments