Search code examples
angularangular-materialangular-ui-bootstrap

Ng serve not working after uninstalling a package


Can you guys help me on how I can run ng serve again successfully.

I worked on an Angular project that used Bootstrap, and then I installed Angular Material, my design was ruined. So, I tried to uninstall Angular Material using npm uninstall @angular/material and it turned out that it got uninstalled successfully. I closed my running server localhost:4200 and then tried to run the project again using ng serve but it gave me this error An unhandled exception occurred: ENOENT: no such file or directory, lstat 'D:\desktop\github_repos\library-management-system\node_modules\@angular\material' See "C:\Users\Dell\AppData\Local\Temp\ng-XYBGzp\angular-errors.log" for further details.

Follow up question: Does Bootstrap and Angular Material cannot work together?

Thank you!

And this is the contents inside the angular-errors.log file:

    at Object.realpathSync (fs.js:1800:7)
    at resolveGlobalStyles (D:\desktop\github_repos\library-management-system\node_modules\@angular-devkit\build-angular\src\webpack\configs\styles.js:54:31)
    at Object.getStylesConfig (D:\desktop\github_repos\library-management-system\node_modules\@angular-devkit\build-angular\src\webpack\configs\styles.js:87:70)
    at D:\desktop\github_repos\library-management-system\node_modules\@angular-devkit\build-angular\src\dev-server\index.js:153:23
    at generateWebpackConfig (D:\desktop\github_repos\library-management-system\node_modules\@angular-devkit\build-angular\src\utils\webpack-browser-config.js:59:49)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async generateBrowserWebpackConfigFromContext (D:\desktop\github_repos\library-management-system\node_modules\@angular-devkit\build-angular\src\utils\webpack-browser-config.js:116:20)
    at async Object.generateI18nBrowserWebpackConfigFromContext (D:\desktop\github_repos\library-management-system\node_modules\@angular-devkit\build-angular\src\utils\webpack-browser-config.js:66:20)
    at async setup (D:\desktop\github_repos\library-management-system\node_modules\@angular-devkit\build-angular\src\dev-server\index.js:149:47)```

Solution

  • Make sure you are not using any Angular Material in your code. And check the package.json if @angular/material is deleted from the dependecies list, then run ‘ npm install ‘