Node-sass not found (tho using sass) with Yarn 2
See original GitHub issueBug 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
- Manually create nextjs project
- Use node
14.4.0
andyarn v2
- Add
next.config.js
like above - Install
sass
withyarn v2
- Import scss file
- 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:
- Created 3 years ago
- Reactions:4
- Comments:10 (6 by maintainers)
Top Results From Across the Web
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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ll try to do this next week.
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?