Repository navigation
Description
I've encountered a fair few errors when trying to create a production build. This seems to be the one that won't go away for me and I'm pretty stuck as it is. Deploying locally via ng-serve works fine however ng-build is not. Any help would be very appreciated. I'm thinking that there is a version mismatch between my angular packages.
Bug Report or Feature Request (mark with an x)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
@angular/cli: 1.0.0-rc.4
node: 7.0.0
os: win32 x64
@angular/cli: 1.0.0-rc.4
@angular/common: 2.4.7
@angular/compiler: 2.4.7
@angular/core: 2.4.7
@angular/forms: 2.4.7
@angular/http: 2.4.7
@angular/platform-browser: 2.4.7
@angular/platform-browser-dynamic: 2.4.7
@angular/router: 3.4.7
@angular/compiler-cli: 4.0.0-rc.5
@ngtools/webpack: 1.2.14
Repro steps.
ng build -prod
The log given by the failure.
ERROR in TypeError: Cannot read property 'match' of undefined
-
suppress-entry-chunks-webpack-plugin.js:40 filterFn
[Angular_whiskey]/[@angular]/cli/plugins/suppress-entry-chunks-webpack-plugin.js:40:91 -
Array.filter
-
suppress-entry-chunks-webpack-plugin.js:42 Compilation.compilation.plugin
[Angular_whiskey]/[@angular]/cli/plugins/suppress-entry-chunks-webpack-plugin.js:42:59 -
Tapable.js:208 Compilation.applyPluginsAsyncWaterfall
[Angular_whiskey]/[tapable]/lib/Tapable.js:208:13 -
util.js:16 Compilation.tryCatcher
[Angular_whiskey]/[bluebird]/js/release/util.js:16:23 -
index.js:642
[Angular_whiskey]/[html-webpack-plugin]/index.js:642:12 -
index.js:152
[Angular_whiskey]/[html-webpack-plugin]/index.js:152:16 -
util.js:16 tryCatcher
[Angular_whiskey]/[bluebird]/js/release/util.js:16:23 -
promise.js:512 Promise._settlePromiseFromHandler
[Angular_whiskey]/[bluebird]/js/release/promise.js:512:31 -
promise.js:569 Promise._settlePromise
[Angular_whiskey]/[bluebird]/js/release/promise.js:569:18 -
promise.js:614 Promise._settlePromise0
[Angular_whiskey]/[bluebird]/js/release/promise.js:614:10 -
promise.js:693 Promise._settlePromises
[Angular_whiskey]/[bluebird]/js/release/promise.js:693:18 -
async.js:133 Async._drainQueue
[Angular_whiskey]/[bluebird]/js/release/async.js:133:16 -
async.js:143 Async._drainQueues
[Angular_whiskey]/[bluebird]/js/release/async.js:143:10 -
async.js:17 Immediate.Async.drainQueues
[Angular_whiskey]/[bluebird]/js/release/async.js:17:14
Desired functionality.
Trying to create a production build to deploy to heroku.
Mention any other details that might be useful.
package.json
{
"name": "angular-whiskey",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "node server.js",
"lint": "tslint "src/**/*.ts"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor",
"postinstall": "ng build --aot -prod"
},
"private": true,
"engines": {
"node": "7.0.0",
"npm": "4.4.1"
},
"dependencies": {
"@angular/cli": "^1.0.0-rc.2",
"@angular/common": "2.4.7",
"@angular/compiler": "2.4.7",
"@angular/core": "2.4.7",
"@angular/forms": "2.4.7",
"@angular/http": "2.4.7",
"@angular/platform-browser": "2.4.7",
"@angular/platform-browser-dynamic": "2.4.7",
"@angular/router": "3.4.7",
"@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.20",
"@ngtools/webpack": "^1.2.4",
"@types/core-js": "^0.9.37",
"@types/jasmine": "^2.5.38",
"@types/node": "^6.0.65",
"angularfire2": "^2.0.0-beta.7-pre",
"auth0-lock": "^10.13.0",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"express": "^4.15.2",
"firebase": "^3.7.1",
"ng2-bootstrap": "^1.4.0",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"typescript": "2.2.1",
"zone.js": "^0.6.23"
},
"devDependencies": {
"@angular/cli": "^1.0.0-rc.4",
"@angular/compiler-cli": "4.0.0-rc.5",
"@types/core-js": "^0.9.34",
"@types/jasmine": "^2.2.30",
"@types/node": "^6.0.42",
"codelyzer": "1.0.0-beta.1",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"node-sass": "^3.10.1",
"protractor": "4.0.9",
"raw-loader": "^0.5.1",
"sass-loader": "^4.0.2",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "~2.0.3",
"webdriver-manager": "10.2.5"
}
}
Activity
filipesilva commentedon Mar 23, 2017
That's an odd error.... can you show me your
index.htmlmaybe? We have a bit of logic that checks it on a webpack plugin and it might be bugging out. Do you maybe have a script tag without asrcattribute?Also can you try making a repro that I could have a look at? If it's something in your setup, it might be enough to upload everything but your src folder (or maybe with the src folder of a brand new project).
thojo commentedon Apr 21, 2017
I had the same Problem on Windows but also no
vendor.bundle.jswas generated (just like with option--no-vendor-chunk).For me the cause was a symlink. When executing
ng build --prodfrom D:\symlink\project (where D:\symlink Points to D:\directory) I got this error. Executing from D:\directory\project (no symlink in path) the error "TypeError: Cannot read property 'match' of undefined" is gone and avendor.bundle.jsfile is generated again.swaheed2 commentedon Apr 23, 2017
I had the same exact error on windows with running ng build --prod. I changed to an admin cmd and the problem went away.
apspot commentedon Apr 27, 2017
Thanks @thojo & @swaheed2 ! Without symlink and with admin cmd the deploy went smoothly :)
jaynzr commentedon May 2, 2017
Encountered the same error on Windows and can confirm that moving the project out of directory junction fixed the issue.
filipesilva commentedon May 23, 2017
Fixed by #6403 then.
benjaminrau commentedon Jul 17, 2017
@filipesilva Should the fix also apply to the scenario mentioned by @swaheed2 ?
ive updated cli to 1.2.1 but still i cant run ng serve --prod from a bat file on Windows but rather need to start and admin cmd.
filipesilva commentedon Jul 17, 2017
@benjaminrau there's nothing in the CLI that requires admin permissions.
mdkiefer commentedon Sep 27, 2017
Changing this:
to:
fixes the problem.
thepian commentedon Jan 30, 2018
Doesn't seem to be fixed
front-end-developer commentedon Apr 23, 2018
this frustration thing, Angular 5, I get the same error, I spent days on this, and ng build --prod is not working at all.
I even upgraded angular to angular 6 and the error is still there.
I expected Angular 5/6 to be an improvement not a nightmare to put you off angular.
front-end-developer commentedon Apr 26, 2018
I fixed it by changing the typescript version.
angular-automatic-lock-bot commentedon Sep 8, 2019
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.