简体   繁体   中英

ERROR in ./node_modules/css-loader? - in my styles.css @import “~bootstrap/dist/css/bootstrap.css”

I am using - following configuration on windows 8 64 bit.

Angular CLI: 1.6.4 Node: 8.9.4 OS: win32 x64 Angular: 5.2.2
typescript: 2.5.3 webpack: 3.10.0

Following error occurs when trying to (compile webpack)run angular on cli:-

ERROR in
./node_modules/css-loader?{"sourceMap":false,"import":false}!./node_mod
ules/postcss-loader/lib?{"ident":"postcss","sourceMap":false}!./src/styles.css
Module build failed: Error: Can't resolve
'~bootstrap/dist/css/bootstrap.css' in 'F:\code\hello-world\src' at
onError
(F:\code\hello-world\node_modules\enhanced-resolve\lib\Resolver.j
s:61:15)

@ ./src/styles.css 4:14-138 @ multi ./src/styles.css

webpack: Failed to compile.

There are some things you can try,

  1. Run npm install command again.
  2. Try delete the entire npm_modules folder and run npm install .
  3. Try reinstalling bootstrap.
  4. Make sure you are installing the latest bootstrap.
  5. Try updating the Angular CLI as some version of it has some issues, or uninstall and install it.
  6. If none of the above worked, you can do npm rebuild node-sass command.

I hope any of the above steps will work for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM