Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined at levenshtein (F:\Learnings\AngularHandsOn\Angular6\angular6Handson\node_modules\@angular\cli\models\command-runner.js:58:23) at listAllCommandNames.sort (F:\Learnings\AngularHandsOn\Angular6\angular6Handson\node_modules\@angular\cli\models\command-runner.js:69:43) at Array.sort (native) at Object. (F:\Learnings\AngularHandsOn\Angular6\angular6Handson\node_modules\@angular\cli\models\command-runner.js:67:65) at Generator.next () at F:\Learnings\AngularHandsOn\Angular6\angular6Handson\node_modules\@angular\cli\models\command-runner.js:7:71 at new Promise () at __awaiter (F:\Learnings\AngularHandsOn\Angular6\angular6Handson\node_modules\@angular\cli\models\command-runner.js:3:12) at Object.runCommand (F:\Learnings\AngularHandsOn\Angular6\angular6Handson\node_modules\@angular\cli\models\command-runner.js:28:12) at F:\Learnings\AngularHandsOn\Angular6\angular6Handson\node_modules\@angular\cli\lib\cli\index.js:60:58
When I am directly pasting url in browser then all are working fine even its not showing any error in console window. But when I use ng -o command then it shows me error.
I am using angular cli 6.0.0
I got the same error & it took me hours to resolve because the error was misleading to me, it was actually because I tried these 2 incorrect commands:
ng -build -prod
ng -build --prod
Both of the above commands gave that error, so I thought I have a problem in my code & kept looking for it, the solution was simply to use the correct command below:
ng build --prod
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With