Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):

I have created an application on angular 7 and ionic 4. I tried to edit app.routing.ts file, setting path and component. From then on I am getting this error below:

ERROR in ./src/app/department/department.module.ts
[ng] Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
[ng] Error: ENOENT: no such file or directory, open 'C:\Users\x\department\department.module.ts'
[ng]     at Object.openSync (fs.js:436:3)
[ng]     at Object.readFileSync (fs.js:341:35)
[ng]     at Storage.provideSync (C:\Users\x\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:98:13)
like image 681
user9885720 Avatar asked Jun 17 '19 10:06

user9885720


2 Answers

Make sure department component exist, check the templateUrl that corresponds to the file name you are referencing. You may have also modified the path unknowingly during modification of app.routing.ts file.

C:\Users\x\department\department.module.ts

like image 84
trustidkid Avatar answered Nov 03 '22 19:11

trustidkid


This error occurs when your component can't be found with your app.module settings.

Follow these steps to solve your problem:

  1. Check if the module.ts file exists.
  2. Check the relative path.
  3. The path is case sensitive (maybe the .ts file is Department).
like image 1
Vinay sharma Avatar answered Nov 03 '22 21:11

Vinay sharma