Problem running ng build Angular

Asked

Viewed 1,085 times

2

Hello, I’m having trouble in Angular when I run the following command to building in the project directory ng build --prod --aot=false, how do I fix the problem? What and why is this error occurring?
Below is the log of the error that occurs after executing the command.

ERROR in vendor.0963fa6ef0f8a97eaa25.bundle.js from UglifyJs
TypeError: Cannot read property '_walk' of null
    at AST_Dot.eval (eval at <anonymous> (/home/marcelo/Desktop/Mercatorio/dashboard/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:1112:29)
    at TreeWalker._visit (eval at <anonymous> (/home/marcelo/Desktop/Mercatorio/dashboard/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:1513:21)
    at AST_Dot._walk (eval at <anonymous> (/home/marcelo/Desktop/Mercatorio/dashboard/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:1111:24)
    at AST_VarDef.eval (eval at <anonymous> (/home/marcelo/Desktop/Mercatorio/dashboard/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:1058:40)
    at TreeWalker._visit (eval at <anonymous> (/home/marcelo/Desktop/Mercatorio/dashboard/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:1513:21)
    at AST_VarDef._walk (eval at <anonymous> (/home/marcelo/Desktop/Mercatorio/dashboard/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:1056:24)
    at AST_Var.eval (eval at <anonymous> (/home/marcelo/Desktop/Mercatorio/dashboard/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:966:32)
    at TreeWalker._visit (eval at <anonymous> (/home/marcelo/Desktop/Mercatorio/dashboard/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:1513:21)
    at AST_Var._walk (eval at <anonymous> (/home/marcelo/Desktop/Mercatorio/dashboard/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:963:24)
    at walk_body (eval at <anonymous> (/home/marcelo/Desktop/Mercatorio/dashboard/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:513:17)
    at AST_Function.eval (eval at <anonymous> (/home/marcelo/Desktop/Mercatorio/dashboard/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:739:13)
    at TreeWalker._visit (eval at <anonymous> (/home/marcelo/Desktop/Mercatorio/dashboard/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:1513:21)
    at AST_Function._walk (eval at <anonymous> (/home/marcelo/Desktop/Mercatorio/dashboard/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:733:24)
    at AST_Function.walk (eval at <anonymous> (/home/marcelo/Desktop/Mercatorio/dashboard/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:467:21)
    at get_lvalues (eval at <anonymous> (/home/marcelo/Desktop/Mercatorio/dashboard/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:8804:34)
    at collapse (eval at <anonymous> (/home/marcelo/Desktop/Mercatorio/dashboard/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:8565:35)

Print of error image: inserir a descrição da imagem aqui

  • Try running the npm install --update-binaries --noshrinkwrap command Something else update your angular cli version

  • Which command to update angular cli

  • npm install -g @angular/cli@latest

  • And one more question the command you want to run to build the right way is this ng build --no-Aot --Prod

  • I’m having trouble upgrading the angular cli, npm ERR! path /usr/lib/node_modules/@angular/cli ...

  • If you are in windows try to run this command as administrator

  • I’m on Linux, when I give a sudo before, he says it all worked out but the cli version of angular permance unchanged

  • Then do the following, remove the angular cli and then install a new version npm remove @angular/cli -g npm cache clean npm i @angular/cli -

  • how do I remove?

  • npm remove @angular/cli -g

  • I removed and reinstalled the angular cli and changed nothing :/

Show 6 more comments

1 answer

1

The error you have apparently relates to this angular-cli link https://github.com/angular/angular-cli/issues/12414#issuecomment-428161804

He says that if your project has a library dependency tether you have to realize the downgrade for version 1.4.3.

Or update the terser for the version 3.10.7, following in the footsteps:

  • check the current installed version of terser: npm ls terser
  • install and uninstall the terser with npm install [email protected] npm uninstall terser
  • now you should see the latest version of the terser in npm ls terser

Browser other questions tagged

You are not signed in. Login or sign up in order to post.