Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Can't resolve './alert' in '/mydirectory/node_modules/bootstrap/scss' #567

Closed
adrian2020my opened this issue May 6, 2018 · 17 comments

Comments

@adrian2020my
Copy link

adrian2020my commented May 6, 2018

I use @import "~bootstrap/scss/bootstrap"; in my custom.scss but when webpack tries to compile, the following error appears:

Failed to compile.

./node_modules/bootstrap/scss/bootstrap.scss
Module not found: Can't resolve './alert' in 'mydirectory/node_modules/bootstrap/scss'

Please kindly advise on resolving this issue as I'm not able to customise my css using mixins from bootstrap.

My webpack.config file is as below:
webpack.config.txt

@alexander-akait
Copy link
Member

@adrian2020my please provide minimum reproducible test repo, we can't help without structure and version bootstrap, thanks

@adrian2020my
Copy link
Author

Thanks for the reply. @evilebottnawi Here is the repo: https://github.com/adrian2020my/webpackBootstrap

@alexander-akait
Copy link
Member

alexander-akait commented May 6, 2018

@adrian2020my can you decrease sass-loader version to 6? and test again?

@adrian2020my
Copy link
Author

adrian2020my commented May 6, 2018

I lowered the version of sass-loader to 6.0.7 but it still doesn't compile. @evilebottnawi

@alexander-akait
Copy link
Member

@adrian2020my includePaths: ['src', 'node_modules'] for sas-loader options?

@adrian2020my
Copy link
Author

@evilebottnawi Sorry, it works. I managed to compile it, had to remove the previous version first before reinstalling the older version of sass-loader. May I know why it doesn't compile in the latest version?

@alexander-akait
Copy link
Member

@adrian2020my #556 on next week i will try to find time on fix it, just regression

@alexander-akait
Copy link
Member

Can we close issue?

@adrian2020my
Copy link
Author

@evilebottnawi sorry for my previous comment, it still doesn't work. When I tested the working one, I accidentally removed the import "~bootstrap/scss/bootstrap"; After I tried it, still doesn't compile.

@adrian2020my
Copy link
Author

@evilebottnawi Currently, I'm back to square one. ./node_modules/bootstrap/scss/bootstrap.scss
Module not found: Can't resolve './alert' in '/frontend/node_modules/bootstrap/scss'

@alexander-akait
Copy link
Member

@adrian2020my #567 (comment)?

@adrian2020my
Copy link
Author

@evilebottnawi Yes, that comment about it working was false. In that particular part, I accidentally removed the import "~bootstrap/scss/bootstrap"; so it worked.(was doing other stuff, so had to make it work) My problem was that when I do the import, it doesn't compile. So sorry for that.

@adrian2020my
Copy link
Author

After struggling with this issue the entire day, I managed to go around my problem by following the instructions in facebook/create-react-app: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-a-css-preprocessor-sass-less-etc . I was not able to fully resolve my issue in regards to the importing the bootstrap module. Maybe facebook has configured webpack to the point where it's hard to directly import sass file from node_modules/ to the src directory.

@jsg2021
Copy link

jsg2021 commented May 14, 2018

This must be a duplicate of #566

@alexander-akait
Copy link
Member

@jsg2021 yep, duplicate thanks!

@MAGDD
Copy link

MAGDD commented Jan 3, 2019

1 .import own scss langage not css langage so app.css should be app.scss
2. add .addStyleEntry('css/app', './assets/css/app.scss') in webpack.config.js file
3. be sure node-sass et sass-loader are installed(yarn add -D node-sass sass-loader)

@vegagame
Copy link

vegagame commented May 2, 2020

1 .import own scss langage not css langage so app.css should be app.scss
2. add .addStyleEntry('css/app', './assets/css/app.scss') in webpack.config.js file
3. be sure node-sass et sass-loader are installed(yarn add -D node-sass sass-loader)

Good! It work also for me! :)

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

No branches or pull requests

5 participants