Module not found : error : Can't resolve 'ngx-bootstrap'
Asked Answered
J

2

7

I'm trying to build my project after upgrading my Angular version to v8,when I compiled my project I got following error,

1>Module not found : error : Can't resolve 'ngx-bootstrap' in 'C:\Users\can.pahali\source\WestCore.MvcSpa-Upgrade'
1>     @ dll vendor vendor[9]
1>    Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js!node_modules/bootstrap/dist/css/bootstrap.css:
1>        Entrypoint mini-css-extract-plugin = *
1>    Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js!node_modules/font-awesome/css/font-awesome.css:
1>        Entrypoint mini-css-extract-plugin = *
1>    Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js!node_modules/startbootstrap-sb-admin-2/dist/css/sb-admin-2.css:
1>        Entrypoint mini-css-extract-plugin = *
1>C:\Users\can.pahali\source\WestCore.MvcSpa-Upgrade\WestCore.MvcSpa.csproj(156,5): error MSB3073: The command "node --max-old-space-size=4096 node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js" exited with code 2.
1>Done building project "WestCore.MvcSpa.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

My ng v output is here,

Angular CLI: 8.3.27
Node: 13.5.0
OS: win32 x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.8
@angular-devkit/build-angular     0.901.8
@angular-devkit/build-optimizer   0.901.8
@angular-devkit/build-webpack     0.901.8
@angular-devkit/core              7.1.2
@angular-devkit/schematics        8.3.27
@angular/cdk                      8.2.3
@angular/cli                      8.3.27
@angular/http                     7.2.16
@ngtools/webpack                  7.1.2
@nguniversal/aspnetcore-engine    7.1.1
@nguniversal/common               7.1.1
@schematics/angular               8.3.27
@schematics/update                0.803.27
rxjs                              6.5.5
typescript                        3.5.3
webpack                           4.43.0

I checked my ngx-bootstrap imports as well, they're all seems fine without errors. I can also share my package.json file if needed. I'm really stuck here, any help would be life-sustaining for me, thank you.

Best regards.

Jornada answered 16/6, 2020 at 8:23 Comment(8)
Check your node_modules folder if ngx-bootstrap is really there firstIey
When modules are broken some times delete the folder ngx-bootstrap in your case and rerun a npm install, sometimes it's magical.And
@And Yes I checked, node_modules contains ngx-bootstrap folder and rerun npm i. But It's still same :(Jornada
@EliranEliassy Yes It's actually there.Jornada
running npm link and afterwards npm install works? It should sync the global and local node_modules folder, maybe you command searches the global locationCastle
can you try uninstalling and then reinstall the package? npm uninstall ngx-bootstrap and then npm install ngx-bootstrapEgocentric
@RazRonen I tried npm link in my project file, then npm install but same issue here :(Jornada
@Egocentric Yes, I tried reinstalling component many times but still same.Jornada
J
7

I think I figured out the issue here, I was using [email protected], I downgraded the version [email protected] and problem was gone. There must be a problem with my Angular 8 version that is not compatible with > [email protected]. I'll also report this issue on github.

Best regards.

Jornada answered 17/6, 2020 at 8:18 Comment(1)
I am facing the same problem for Angular 7.1.2 Did u find any solution for [email protected]?Forensic
F
2

For me deleting ngx-bootstrap folder in node_modules, then run npm i and npm audit fix solves de problem

False answered 20/7, 2021 at 1:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.