Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

sass failed to compile #162

Closed
m4rcTr3y opened this issue Jul 13, 2021 · 13 comments · Fixed by vitejs/vite#4853
Closed

sass failed to compile #162

m4rcTr3y opened this issue Jul 13, 2021 · 13 comments · Fixed by vitejs/vite#4853
Assignees

Comments

@m4rcTr3y
Copy link

hey i installed the sass library into my project but still got this error. Any fixes on this

ERROR 17:41:35 [vite] Internal server error: Preprocessor dependency "sass" not found. Did you install it? 17:41:35
Plugin: vite:css
File: D:/my app/nuxt/macxplore/components/Appheader.vue?vue&type=style&index=0&scoped=true&lang.scss
at loadPreprocessor (D:\my app\nuxt\macxplore\node_modules\vite\dist\node\chunks\dep-11db14da.js:28689:15)
at scss (D:\my app\nuxt\macxplore\node_modules\vite\dist\node\chunks\dep-11db14da.js:28694:20)
at compileCSS (D:\my app\nuxt\macxplore\node_modules\vite\dist\node\chunks\dep-11db14da.js:28438:40)
at async TransformContext.transform (D:\my app\nuxt\macxplore\node_modules\vite\dist\node\chunks\dep-11db14da.js:28108:50)
at async Object.transform (D:\my app\nuxt\macxplore\node_modules\vite\dist\node\chunks\dep-11db14da.js:50885:30)
at async transformRequest (D:\my app\nuxt\macxplore\node_modules\vite\dist\node\chunks\dep-11db14da.js:66636:29)
at async viteTransformMiddleware (D:\my app\nuxt\macxplore\node_modules\vite\dist\node\chunks\dep-11db14da.js:66774:32)

@m4rcTr3y m4rcTr3y changed the title sass sass failed to compile Jul 13, 2021
@king-11
Copy link

king-11 commented Jul 19, 2021

I can also the same error when I was trying to use global css config which works fine without nuxt-vite. Also tried using the below config

export default {
  css: ["@/assets/scss/global.scss"],
  vite: {
    css: {
      preprocessorOptions: {
        scss: {
          additionalData: '@import "@/assets/scss/global.scss";',
        },
      },
    },
  },
}

@brian428
Copy link

Also worth noting that rolling back to 2.3.8 seems to bypass the issue, so this seems to be something that was added after 2.3.8.

@ishiijp
Copy link

ishiijp commented Jul 28, 2021

I set the following settings in package.json, and It works fine.

  "resolutions": {
    "vite": "2.3.8"
  }

Is this a vite problem and not a nuxt-vite problem, right?

@annymosse
Copy link

@ishiijp yes, I have faced same issue when using nuxt-vite whenever the same project work using only nuxt .

@selfagency
Copy link

Same issue. Sass isn't found despite being installed and it works fine if nuxt-vite is disabled. It appears to be an issue affecting Vite versions 2.4+, and nuxt-vite uses ^2.3.4.

 ERROR  Preprocessor dependency "sass" not found. Did you install it?                                     09:56:34

  at loadPreprocessor (node_modules/vite/dist/node/chunks/dep-c1a9de64.js:28714:15)
  at scss (node_modules/vite/dist/node/chunks/dep-c1a9de64.js:28719:20)
  at compileCSS (node_modules/vite/dist/node/chunks/dep-c1a9de64.js:28459:40)
  at async TransformContext.transform (node_modules/vite/dist/node/chunks/dep-c1a9de64.js:28113:50)
  at async Object.transform (node_modules/vite/dist/node/chunks/dep-c1a9de64.js:50939:30)
  at async transformRequest (node_modules/vite/dist/node/chunks/dep-c1a9de64.js:66763:29)
  at async warmup (node_modules/nuxt-vite/dist/nuxt-vite.js-vite.js:386:5)
  at async Promise.all (index 6)
  at async warmup (node_modules/nuxt-vite/dist/nuxt-vite.js-vite.js:388:5)
  at async Promise.all (index 8)
  at async warmup (node_modules/nuxt-vite/dist/nuxt-vite.js-vite.js:388:5)
  at async Promise.all (index 4)
  at async warmup (node_modules/nuxt-vite/dist/nuxt-vite.js-vite.js:388:5)
  at async Promise.all (index 0)
  at async warmupViteServer (node_modules/nuxt-vite/dist/nuxt-vite.js-vite.js:390:3)

Pinning the Vite version at 2.3.8 seemed to remove that error for me, but it introduced a new one:


 ERROR  Cannot read property 'importedModules' of undefined                                               10:06:56

  at warmup (node_modules/nuxt-vite/dist/nuxt-vite.js-vite.js:387:71)
  at async Promise.all (index 4)
  at async warmup (node_modules/nuxt-vite/dist/nuxt-vite.js-vite.js:388:5)
  at async Promise.all (index 5)
  at async warmup (node_modules/nuxt-vite/dist/nuxt-vite.js-vite.js:388:5)
  at async Promise.all (index 8)
  at async warmup (node_modules/nuxt-vite/dist/nuxt-vite.js-vite.js:388:5)
  at async Promise.all (index 4)
  at async warmup (node_modules/nuxt-vite/dist/nuxt-vite.js-vite.js:388:5)
  at async Promise.all (index 0)
  at async warmupViteServer (node_modules/nuxt-vite/dist/nuxt-vite.js-vite.js:390:3)

Rolling back to Vite 2.3.4 did not resolve the above error.

@selfagency
Copy link

Here's a recreation with a fresh install https://githubbox.com/selfagency/vite-sass-error

@selfagency
Copy link

@pi0 just wanted to make sure you saw this, it's a significant problem

@pi0
Copy link
Member

pi0 commented Sep 5, 2021

/cc @antfu would appreciate it if you have time to check on this. According to vitejs/vite#4557 (comment), it can be from jiti but we already fill it from native require.resolve.paths.

@manoj-mukherjee-maersk
Copy link

How it is closed? having facing this issue. using
"nuxt-vite": "^0.2.2", "sass": "1.32.13", "sass-loader": "10.1.1",

@maxdzin
Copy link

maxdzin commented Sep 7, 2021

Same for me. Still not able to compile.

@antfu
Copy link
Member

antfu commented Sep 7, 2021

We are still pending for Vite to release

@productdevbook
Copy link
Sponsor Member

We are still pending for Vite to release

yes, vite release: v2.5.4 update and fixed. :) thank youuu

@antfu
Copy link
Member

antfu commented Sep 7, 2021

Released v0.2.4 with Vite version bumpped, should work out-of-box now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.