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.

SASS_PATH=node_modules:src doesn't work

See original GitHub issue

I’m trying to use as stated in https://facebook.github.io/create-react-app/docs/adding-a-sass-stylesheet

  • file .env:
...
SASS_PATH=node_modules:src
...
  • file src/styles/index.scss:
@import "bootstrap/scss/bootstrap";

It gives me this error:

Failed to compile.

./src/styles/index.scss (./node_modules/css-loader??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/lib/loader.js??ref--6-oneOf-5-3!./src/styles/index.scss)
@import "bootstrap/scss/bootstrap";
^
      File to import not found or unreadable: bootstrap/scss/bootstrap.

If I use below (with ~) it works:

  • file src/styles/index.scss:
@import "~bootstrap/scss/bootstrap";
  • package.json:
  "dependencies": {
    "@types/jest": "23.3.13",
    "@types/node": "10.12.20",
    "@types/react": "16.7.22",
    "@types/react-router": "4.4.3",
    "@types/react-router-dom": "4.3.1",
    "@types/react-dom": "16.0.11",
    "bootstrap": "4.2.1",
    "node-sass": "4.11.0",
    "react": "16.7.0",
    "react-dom": "16.7.0",
    "react-router": "4.3.1",
    "react-router-dom": "4.3.1",
    "react-scripts": "2.1.3",
    "typescript": "3.2.4"
  },
  "devDependencies": {
    "source-map-explorer": "1.6.0"
  },

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
a2k42commented, Feb 6, 2019

From the documentation for material-components it looks like the .env entry needs to be:

SASS_PATH=./node_modules

If this works for you then it’s probably just a correction to the documentation that’s needed.

I had the same problem and it’s fixed for me now.

1reaction
monish001commented, Mar 24, 2019

Just created a PR with the fix in the documentation. Please review.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

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