Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vuetify SassError: Expected identifier

Error in sass files Vuetify inside. I tried to put the dependency below the version, it did not help. What to do about it?

ERROR in ./node_modules/vuetify/src/styles/main.sass (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!./node_modules/postcss-loader/src??ref--6-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--6-oneOf-1-3!./node_modules/sass-resources-loader/lib/loader.js??ref--6-oneOf-1-4!./node_modules/vuetify/src/styles/main.sass)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Expected identifier.
   ╷
34 │         .v-application .red.#E82550{
   │                             ^
   ╵
  node_modules/vuetify/src/styles/generic/_colors.scss 34:29  @import
  node_modules/vuetify/src/styles/generic/_index.scss 2:9     @import
  node_modules/vuetify/src/styles/main.sass 38:9              root stylesheet

Please, look at my Package.json

{
  "name": "test",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt build",
    "start": "nuxt start",
    "generate": "nuxt generate"
  },
  "dependencies": {
    "@nuxtjs/axios": "^5.12.2",
    "@nuxtjs/dotenv": "^1.4.1",
    "@nuxtjs/laravel-echo": "^1.1.0",
    "@nuxtjs/style-resources": "^1.0.0",
    "@nuxtjs/svg": "^0.1.12",
    "cookie-universal-nuxt": "^2.1.4",
    "core-js": "^3.7.0",
    "lodash.clonedeep": "^4.5.0",
    "nuxt": "^2.14.7",
    "pusher-js": "^7.0.1",
    "vue-fullscreen": "^2.1.6",
    "vue-perfect-scrollbar": "^0.2.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@nuxt/types": "^2.14.7",
    "@nuxtjs/vuetify": "^1.11.2",
    "babel-loader": "^8.2.1",
    "node-sass": "^4.14.1",
    "sass-loader": "^10.0.2"
  }
}

nuxt.config.js

export default {
  // Disable server-side rendering (https://go.nuxtjs.dev/ssr-mode)
  ssr: false,

  // Global page headers (https://go.nuxtjs.dev/config-head)
  head: {
    title: 'nlmk--front',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },

  styleResources: {
    sass: [
      './assets/styles/sass/_variables.sass',
      './assets/styles/sass/_mixins.sass',
    ]
  },

  // Global CSS (https://go.nuxtjs.dev/config-css)
  css: [
    './assets/styles/sass/_reset.sass',
    './assets/fonts/roboto/roboto.css',
    './assets/styles/sass/default.sass',
  ],

  // Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
  plugins: [
    '~/plugins/resize',
    //'~/plugins/vuetify',
    '~/plugins/fullscreen'
  ],
  vuetify: {},
  // Auto import components (https://go.nuxtjs.dev/config-components)
  components: true,

  // Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules)
  buildModules: [
    '@nuxtjs/vuetify',
  ],
  // Modules (https://go.nuxtjs.dev/config-modules)
  modules: [
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios',
    '@nuxtjs/svg',
    '@nuxtjs/style-resources',
    'cookie-universal-nuxt',
    '@nuxtjs/laravel-echo',
  ],

  // Axios module configuration (https://go.nuxtjs.dev/config-axios)
  axios: {
    debug: false,
    retry: { retries: 3 },
    baseURL: process.env.API_URL
  },

  // Build Configuration (https://go.nuxtjs.dev/config-build)
  build: {
    extend(config, { isDev, isClient, isServer }) {
      if (!isDev) {
        config.output.publicPath = '/_nuxt/'
      }
    }
  }
}

Error in sass files Vuetify inside. I tried to put the dependency below the version, it did not help. What to do about it?

enter image description here

like image 564
Stanislav Nasonov Avatar asked Nov 25 '20 11:11

Stanislav Nasonov


2 Answers

Had a similar error. It was very annoying because it came with the "default" project vue create prj / vue add vuetify after copy pasting the example for v-select from the vuetify page...

Other posts I've seen suggest using sass and not node-sass, but I was already doing that. (check your project's package.json file)

I found the solution for a similar problem I had was to install an older version of sass:

npm install [email protected]
like image 165
ntg Avatar answered Nov 12 '22 09:11

ntg


Catch same issue right now. Look here https://vuetifyjs.com/en/features/sass-variables/#variable-api

Guess you have variables.scss file and vuetify plugin try to resolve it and crashes.

I've simply renamed it in a way of fast workaround and it's works.

like image 1
Yuriy Cherkashin Avatar answered Nov 12 '22 09:11

Yuriy Cherkashin