angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Module build failed: TypeError: Cannot read property '_statSync' of undefined

Open pierregouret opened this issue 8 years ago • 6 comments

Bug Report or Feature Request (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [x ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Angular CLI: 1.7.4 Node: 8.12.0 OS: linux x64 Angular: 5.2.11 @angular/cli: 1.7.4 @angular/forms: 5.2.10 @angular-devkit/build-optimizer: 0.3.2 @angular-devkit/core: 0.3.2 @angular-devkit/schematics: 0.3.2 @ngtools/json-schema: 1.2.0 @ngtools/webpack: 1.10.2 @schematics/angular: 0.3.2 @schematics/package-update: 0.3.2 typescript: 2.4.2 webpack-node-externals: 1.7.2 webpack: 3.12.0

Repro steps

@angular/cli: 1.7.4

ng new app-ng5
ng build -prod

The log given by the failure

ERROR in ./src/app/app.module.ngfactory.js Module build failed: TypeError: Cannot read property '_statSync' of undefined at stat (/projects/test/app-project/node_modules/@ngtools/webpack/src/virtual_file_system_decorator.js:26:29) at toDepDetails (/projects/test/app-project/node_modules/cache-loader/dist/index.js:66:5) at arrayIterator (/projects/test/app-project/node_modules/neo-async/async.js:3780:9) at timesSync (/projects/test/app-project/node_modules/neo-async/async.js:2292:7) at Object.mapLimit (/projects/test/app-project/node_modules/neo-async/async.js:3775:5) at Array. (/projects/test/app-project/node_modules/cache-loader/dist/index.js:89:18) at arrayEachFunc (/projects/test/app-project/node_modules/neo-async/async.js:2512:19) at Object.parallel (/projects/test/app-project/node_modules/neo-async/async.js:6867:9) at Object.loader (/projects/test/app-project/node_modules/cache-loader/dist/index.js:88:9) ERROR in ./node_modules/core-js/es7/reflect.js Module build failed: TypeError: Cannot read property '_statSync' of undefined at stat (/projects/test/app-project/node_modules/@ngtools/webpack/src/virtual_file_system_decorator.js:26:29) at toDepDetails (/projects/test/app-project/node_modules/cache-loader/dist/index.js:66:5) at arrayIterator (/projects/test/app-project/node_modules/neo-async/async.js:3780:9) at timesSync (/projects/test/app-project/node_modules/neo-async/async.js:2292:7) at Object.mapLimit (/projects/test/app-project/node_modules/neo-async/async.js:3775:5) at Array. (/projects/test/app-project/node_modules/cache-loader/dist/index.js:89:18) at arrayEachFunc (/projects/test/app-project/node_modules/neo-async/async.js:2512:19) at Object.parallel (/projects/test/app-project/node_modules/neo-async/async.js:6867:9) at Object.loader (/projects/test/app-project/node_modules/cache-loader/dist/index.js:88:9) ERROR in ./node_modules/@angular/platform-browser/esm5/platform-browser.js Module build failed: TypeError: Cannot read property '_statSync' of undefined at stat (/projects/test/app-project/node_modules/@ngtools/webpack/src/virtual_file_system_decorator.js:26:29) at toDepDetails (/projects/test/app-project/node_modules/cache-loader/dist/index.js:66:5) at arrayIterator (/projects/test/app-project/node_modules/neo-async/async.js:3780:9) at timesSync (/projects/test/app-project/node_modules/neo-async/async.js:2292:7) at Object.mapLimit (/projects/test/app-project/node_modules/neo-async/async.js:3775:5) at Array. (/projects/test/app-project/node_modules/cache-loader/dist/index.js:89:18) at arrayEachFunc (/projects/test/app-project/node_modules/neo-async/async.js:2512:19) at Object.parallel (/projects/test/app-project/node_modules/neo-async/async.js:6867:9) at Object.loader (/projects/test/app-project/node_modules/cache-loader/dist/index.js:88:9) ERROR in ./node_modules/zone.js/dist/zone.js Module build failed: TypeError: Cannot read property '_statSync' of undefined at stat (/projects/test/app-project/node_modules/@ngtools/webpack/src/virtual_file_system_decorator.js:26:29) at toDepDetails (/projects/test/app-project/node_modules/cache-loader/dist/index.js:66:5) at arrayIterator (/projects/test/app-project/node_modules/neo-async/async.js:3780:9) at timesSync (/projects/test/app-project/node_modules/neo-async/async.js:2292:7) at Object.mapLimit (/projects/test/app-project/node_modules/neo-async/async.js:3775:5) at Array. (/projects/test/app-project/node_modules/cache-loader/dist/index.js:89:18) at arrayEachFunc (/projects/test/app-project/node_modules/neo-async/async.js:2512:19) at Object.parallel (/projects/test/app-project/node_modules/neo-async/async.js:6867:9) at Object.loader (/projects/test/app-project/node_modules/cache-loader/dist/index.js:88:9) ERROR in ./node_modules/@angular/core/esm5/core.js Module build failed: TypeError: Cannot read property '_statSync' of undefined at stat (/projects/test/app-project/node_modules/@ngtools/webpack/src/virtual_file_system_decorator.js:26:29) at toDepDetails (/projects/test/app-project/node_modules/cache-loader/dist/index.js:66:5) at arrayIterator (/projects/test/app-project/node_modules/neo-async/async.js:3780:9) at timesSync (/projects/test/app-project/node_modules/neo-async/async.js:2292:7) at Object.mapLimit (/projects/test/app-project/node_modules/neo-async/async.js:3775:5) at Array. (/projects/test/app-project/node_modules/cache-loader/dist/index.js:89:18) at arrayEachFunc (/projects/test/app-project/node_modules/neo-async/async.js:2512:19) at Object.parallel (/projects/test/app-project/node_modules/neo-async/async.js:6867:9) at Object.loader (/projects/test/app-project/node_modules/cache-loader/dist/index.js:88:9)

pierregouret avatar Oct 31 '18 09:10 pierregouret

Linked to cache-loader, see https://github.com/webpack-contrib/cache-loader/issues/46#issuecomment-434596692

H--o-l avatar Oct 31 '18 09:10 H--o-l

Resolved the issue by installing cache-loader version 1.2.2.

santoshyadavdev avatar Oct 31 '18 09:10 santoshyadavdev

Thanks guys :+1:

pierregouret avatar Oct 31 '18 10:10 pierregouret

Yeah its working after adding "cache-loader": "1.2.2" " in package.json. Thanks @H--o-l @santoshyadav198613

abhinavJai avatar Oct 31 '18 11:10 abhinavJai

It worked for me too. Thank you very much

charlesgathu avatar Nov 09 '18 07:11 charlesgathu

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.