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

user9885720 picture user9885720 · Jun 17, 2019 · Viewed 9.6k times · Source

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)

Answer

trustidkid picture trustidkid · Sep 20, 2019

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