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.

Node-sass not found (tho using sass) with Yarn 2

See original GitHub issue

Bug report

Describe the bug

Trying to import scss file and but got an error:

Error: sass-loader tried to access node-sass (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

next.config.js

module.exports = {
  sassOptions: {
    implementation: require('sass'),
  },
}

The bug doesn’t appear if I use npm instead of yarn v2 or/and if node version is 12.18.0 instead of 14.4.0.

To Reproduce

  1. Manually create nextjs project
  2. Use node 14.4.0 and yarn v2
  3. Add next.config.js like above
  4. Install sass with yarn v2
  5. Import scss file
  6. Run yarn dev

Expected behavior

Run without error by using dart-sass implementation.

System information

  • OS: OSX 10.15.5 (19F101)
  • Version of Next.js: 9.4.4
  • Version of Node.js: 14.4.0

Additional context

Using typescript and yarn v2 workspaces, but I think that’s not the case.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
chrisandscommented, Jun 26, 2020

I’ll try to do this next week.

1reaction
Timercommented, Jun 15, 2020

We really need to add proper Yarn 2 E2E tests to the Next.js repo so we don’t keep regressing on these features! Could you try to write that test suite?

Read more comments on GitHub >

github_iconTop Results From Across the Web

node-sass | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
Yarn - Node Sass does not yet support my current environment
I'm using OSX latest version(10.14.4 (18E226)) and node 12. While using node-sass 4.11, I had g++ error( ../src/create_string.cpp:17:25: ...
Read more >
Install Sass
First install Sass using one of the options below, then run sass --version to be sure it installed correctly. If it did, this...
Read more >
sass-loader - npm
Start using sass-loader in your project by running `npm i ... Node Sass does not work with Yarn PnP feature and doesn't support...
Read more >
Cannot find module 'node-sass' error | bobbyhadz
To solve the error "Cannot find module 'node-sass'", make sure to install the node-sass package by opening your terminal in your project's root...
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