question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't find stylesheet to import.

See original GitHub issue

Do you want to request a feature or report a bug? Bug

What is the current behavior? unable to start app because import sass file throwing error

If the current behaviour is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn’t have dependencies other than React. Paste the link to your CodeSandbox (https://codesandbox.io/s/new) example below: You can use my repo: https://github.com/martinadamec/react-toastify-test Or easy steps:

npx create-react-app my-app --template typescript
npm i react-toastify sass

Create new file test.scss and add following content:

@import "~react-toastify/scss/main";

and import the file into App.tsx

import "./test.scss";

and start the app

npm start

What is the expected behavior? is possible to start app

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

  • node 14.19.3
  • npm 6.14.17
  • react 18.1.0 (same situation with v16)

Error log

SassError: Can't find stylesheet to import.
  ╷
1 │ @import "~react-toastify/scss/main";
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  src/test.scss 1:9  root stylesheet
ERROR in ./src/test.scss (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[7].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[7].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[1].oneOf[7].use[3]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[7].use[4]!./src/test.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
  ╷
1 │ @import "~react-toastify/scss/main";
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵

Any guess what would be wrong? I solved this by downgrading to react-toastify v8. Thanks in advance

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
fkhadracommented, Aug 7, 2022

@martinadamec should be fixed in the latest release

1reaction
fkhadracommented, Jun 1, 2022

Hey, in order to import the stylesheet you have to do

import "react-toastify/dist/ReactToastify.css"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Sass "Error: Can't find stylesheet to import." - Stack Overflow
This happened to me because I was running ng build --prod within a folder other than the root project folder, and every other...
Read more >
Error: Can't find stylesheet to import. · Issue #3269 - GitHub
use the proper relative import (i.e. @import "abstracts/reset" ); define a load path from which imports can be resolved (which might be what ......
Read more >
Executing Sass - Can't find stylesheet to import - Syncfusion
Hi :) I'm currently trying to do the following: code.png. So I import the base styles, then I override some scss variables, and...
Read more >
SCSS Error: Can't find stylesheet to import.
the error comes from SASS compiler, not from the IDE. IDE tricks, like marking folders as Resource roots, won't work here, the compiler...
Read more >
Laravel NPM run Dev error "Can't find stylesheet to import."
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js): SassError: Can't find stylesheet to import. @import "~compass/css3" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found