ERROR in ./src/$$_gendir/app/app.module.ngfactory.ts: Cannot read property 'flags' of undefined

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



ERROR in ./src/$$_gendir/app/app.module.ngfactory.ts: Cannot read property 'flags' of undefined



I'm working on a project based on the Angular Electron Repo, using the Angular 4 versions. When I try to run npm run electron:mac, which in turn runs webpack --display-error-details, the webpack build runs until it hits this error message:


npm run electron:mac


webpack --display-error-details


[XS25] ./src/polyfills.ts 2.45 kB 0 [built]
[0] multi ./src/main.ts 28 bytes 2 [built]
[dvQ4] ./src/environments/index.ts 252 bytes 2 [built]
[kke6] ./src/$$_gendir/app/app.module.ngfactory.ts 3.16 kB 2 [built] [failed] [1 error]
[x35b] ./src/main.ts 376 bytes 2 [built]
[1] multi ./src/polyfills.ts 28 bytes 0 [built]
[2] multi ./src/styles.scss 28 bytes 1 [built]
+ 147 hidden modules

ERROR in ./src/$$_gendir/app/app.module.ngfactory.ts
Module build failed: TypeError: Cannot read property 'flags' of undefined
at resolveAlias (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:24003:37)
at checkAliasSymbol (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:42692:26)
at checkImportBinding (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:42722:13)
at checkImportDeclaration (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:42740:29)
at checkSourceElement (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:43052:28)
at Object.forEach (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:1500:30)
at checkSourceFileWorker (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:43125:20)
at checkSourceFile (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:43105:13)
at getDiagnosticsWorker (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:43169:17)
at getDiagnostics (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:43155:24)
at Object.getEmitResolver (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:23078:13)
at /Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:70539:69
at runWithCancellationToken (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:70295:24)
at getDeclarationDiagnosticsForFileNoCache (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:70538:20)
at getAndCacheDiagnostics (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:70551:26)
at getDeclarationDiagnosticsWorker (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:70535:20)
at getDeclarationDiagnosticsForFile (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:70564:56)
at getDiagnosticsHelper (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:70254:24)
at Object.getDeclarationDiagnostics (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/typescript/lib/typescript.js:70276:24)
at TypeScriptFileRefactor.getDiagnostics (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/@ngtools/webpack/src/refactor.js:52:60)
at Promise.resolve.then.then.then.then (/Users/Evan/Documents/Programming/electron/groupme-client/node_modules/@ngtools/webpack/src/loader.js:505:46)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
@ ./src/main.ts 3:0-74
@ multi ./src/main.ts



I'm not sure what the error message is referring to, no part of my application uses the property flags, including in app.module.ts or main.ts.


flags


app.module.ts


main.ts



I have seen many answers and threads which contain solutions for installing various versions of packages. Things such as upgrading @angular/cli to 1.7.3 and upgrading Typescript to 2.6.2 have only caused other issues. I believe that the issue is not with my installed modules, as the Angular Electron repo provides a working application with an identical set of modules in package.json.


@angular/cli


package.json


"scripts":
"ng": "ng",
"lint": "ng lint",
"start": "npm-run-all --parallel webpack:watch electron:serve",
"webpack:watch": "webpack --watch",
"start:web": "webpack-dev-server --content-base . --port 4200 --inline",
"build:electron:main": "tsc main.ts --outDir dist && copyfiles package.json dist && cd dist && npm install --prod && cd ..",
"build": "webpack --display-error-details && npm run build:electron:main",
"build:prod": "cross-env NODE_ENV=production npm run build",
"electron:serve": "npm run build:electron:main && electron ./dist --serve",
"electron:test": "electron ./dist",
"electron:dev": "npm run build && electron ./dist",
"electron:prod": "npm run build:prod && electron ./dist",
"electron:linux": "npm run build:prod && node package.js --asar --platform=linux --arch=x64",
"electron:windows": "npm run build:prod && node package.js --asar --platform=win32 --arch=ia32",
"electron:mac": "npm run build:prod && node package.js --asar --platform=darwin --arch=x64",
"test": "karma start ./karma.conf.js",
"pree2e": "webdriver-manager update --standalone false --gecko false --quiet && npm run build",
"e2e": "protractor ./protractor.conf.js"
,
"dependencies":
"@angular/common": "4.4.6",
"@angular/compiler": "4.4.6",
"@angular/core": "4.4.6",
"@angular/forms": "4.4.6",
"@angular/http": "4.4.6",
"@angular/platform-browser": "4.4.6",
"@angular/platform-browser-dynamic": "4.4.6",
"@angular/router": "4.4.6",
"core-js": "2.4.1",
"enhanced-resolve": "3.3.0",
"rxjs": "5.4.3",
"zone.js": "0.8.17"
,
"devDependencies":
"@angular/cli": "1.4.9",
"@angular/compiler-cli": "4.4.6",
"@types/core-js": "0.9.36",
"@types/jasmine": "2.5.54",
"@types/node": "7.0.7",
"autoprefixer": "7.1.4",
"codelyzer": "3.2.0",
"copyfiles": "1.2.0",
"cross-env": "5.0.5",
"css-loader": "0.28.7",
"cssnano": "3.10.0",
"electron": "1.7.8",
"electron-packager": "9.1.0",
"electron-reload": "1.2.1",
"exports-loader": "0.6.4",
"file-loader": "0.11.2",
"html-loader": "0.5.1",
"istanbul-instrumenter-loader": "3.0.0",
"jasmine-core": "2.8.0",
"jasmine-spec-reporter": "4.2.1",
"json-loader": "0.5.7",
"karma": "1.7.1",
"karma-chrome-launcher": "2.2.0",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "1.3.0",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"karma-sourcemap-loader": "0.3.7",
"less-loader": "4.0.5",
"minimist": "1.2.0",
"mkdirp": "0.5.1",
"npm-run-all": "^4.1.1",
"postcss-loader": "2.0.6",
"postcss-url": "7.1.2",
"protractor": "5.1.2",
"raw-loader": "0.5.1",
"sass-loader": "6.0.6",
"script-loader": "0.7.1",
"source-map-loader": "0.2.1",
"style-loader": "0.18.2",
"stylus-loader": "3.0.1",
"ts-node": "3.3.0",
"tslint": "5.7.0",
"typescript": "^2.5.3",
"url-loader": "0.5.9",
"webdriver-manager": "12.0.6",
"webpack": "3.6.0",
"webpack-dev-server": "2.8.2"
,



I'm very much out of answers here, any help is appreciated.




1 Answer
1



I started getting this error after i used


ng update



and I resolved the issue by reverting my package.json to the previous version of angular,



I downgraded from 6.1.3 to 6.0.7





All three of those steps completed successfully, but ultimately executing my original command still resulted in the aforementioned error.
– Polyov
Aug 18 at 8:34





I changed my answer for you, please try downgrading angular version.
– mruanova
Aug 18 at 14:43





I am using Angular 4.4.6, so i'm not sure what version you are suggesting I downgrade to?
– Polyov
Aug 18 at 18:26





are you only get the error when using AOT?
– mruanova
Aug 19 at 1:39






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS