Within a java angular application, when I compile with the commands

mvnw -Pprod
mvnw -Pprod package

it gives me the following errors and I don't understand how I can solve them. I'd like to use this in a production environment.

This is the compilation error log that comes up

[INFO] [52, 17]: Identifier 'fileURL' is never reassigned; use 'const' instead of 'var'.
[INFO]
[INFO]
[INFO] WARNING in ./src/main/webapp/app/core/storico/storico.service.ts
[INFO] Module Warning (from ./node_modules/tslint-loader/index.js):
[INFO] [26, 11]: comment must start with a space
[INFO] [34, 11]: comment must start with a space
[INFO] [28, 13]: Identifier 'data' is never reassigned; use 'const' instead of 'let'.
[INFO] [36, 13]: Identifier 'data' is never reassigned; use 'const' instead of 'let'.
[INFO]
[INFO]
[INFO] --- frontend-maven-plugin:1.6:npm (webpack build prod) @ sagriamo ---
[INFO] npm not inheriting proxy config from Maven
[INFO] Running 'npm run webpack:prod' in H:\Programmazione\sagriamo
[INFO]
[INFO] > [email protected] webpack:prod H:\Programmazione\sagriamo
[INFO] > npm run cleanup && npm run webpack:prod:main && npm run clean-www
[INFO]
[INFO]
[INFO] > [email protected] cleanup H:\Programmazione\sagriamo
[INFO] > rimraf target/{aot,www}
[INFO]
[INFO]
[INFO] > [email protected] webpack:prod:main H:\Programmazione\sagriamo
[INFO] > npm run webpack -- --config webpack/webpack.prod.js --profile
[INFO]
[INFO]
[INFO] > [email protected] webpack H:\Programmazione\sagriamo
[INFO] > node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js "--config" "webpack/webpack.prod.js" "--profile"
[INFO]
[ERROR] (node:11148) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
[INFO] Hash: e069b2f0aaa5bf9152de
[INFO] Version: webpack 4.29.0
[INFO] Time: 12503ms
[INFO] Built at: 2019-04-18 19:43:36
[INFO]  6 assets
[INFO] Entrypoint polyfills = app/polyfills.e069b2f0aaa5bf9152de.bundle.js
[INFO] Entrypoint global = global.8cfadacceac75d18abda.css app/global.e069b2f0aaa5bf9152de.bundle.js
[INFO] Entrypoint main = app/main.e069b2f0aaa5bf9152de.bundle.js
[INFO] [0] ./src/main/webapp/app/polyfills.ts 0 bytes {2} [built]
[INFO]     factory:6917ms building:4314ms = 11231ms
[INFO] [1] ./src/main/webapp/content/scss/global.scss 39 bytes {0} [built]
[INFO]     factory:6698ms building:5040ms = 11738ms
[INFO] [2] ./src/main/webapp/app/app.main.ts 0 bytes {1} [built]
[INFO]     factory:6917ms building:4330ms = 11247ms
[INFO]     + 1 hidden module
[INFO]
[INFO] ERROR in src/main/webapp/app/account/cassa/cassa.component.ts(8,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
[INFO]
[ERROR] npm ERR! code ELIFECYCLE
[ERROR] npm ERR! errno 2
[ERROR] npm ERR! [email protected] webpack: `node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js "--config" "webpack/webpack.prod.js" "--profile"`
[ERROR] npm ERR! Exit status 2
[ERROR] npm ERR!
[ERROR] npm ERR! Failed at the [email protected] webpack script.
[ERROR] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[ERROR]
[ERROR] npm ERR! A complete log of this run can be found in:
[ERROR] npm ERR!     C:\Users\Alessio\AppData\Roaming\npm-cache\_logs\2019-04-18T17_43_36_206Z-debug.log
[ERROR] npm ERR! code ELIFECYCLE
[ERROR] npm ERR! errno 2
[ERROR] npm ERR! [email protected] webpack:prod:main: `npm run webpack -- --config webpack/webpack.prod.js --profile`
[ERROR] npm ERR! Exit status 2
[ERROR] npm ERR!
[ERROR] npm ERR! Failed at the [email protected] webpack:prod:main script.
[ERROR] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[ERROR]
[ERROR] npm ERR! A complete log of this run can be found in:
[ERROR] npm ERR!     C:\Users\Alessio\AppData\Roaming\npm-cache\_logs\2019-04-18T17_43_36_254Z-debug.log
[ERROR] npm ERR! code ELIFECYCLE
[ERROR] npm ERR! errno 2
[ERROR] npm ERR! [email protected] webpack:prod: `npm run cleanup && npm run webpack:prod:main && npm run clean-www`
[ERROR] npm ERR! Exit status 2
[ERROR] npm ERR!
[ERROR] npm ERR! Failed at the [email protected] webpack:prod script.
[ERROR] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[ERROR]
[ERROR] npm ERR! A complete log of this run can be found in:
[ERROR] npm ERR!     C:\Users\Alessio\AppData\Roaming\npm-cache\_logs\2019-04-18T17_43_36_309Z-debug.log
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:12 min
[INFO] Finished at: 2019-04-18T19:43:36+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.6:npm (webpack build prod) on project sagriamo: Failed to run task: 'npm run webpack:prod' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 2 (Exit value: 2) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information ab`enter code here`out the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

1 Answers

0
Saulius On

there is a line stating the ERROR which happens during npm build of your Angular application

[INFO] ERROR in src/main/webapp/app/account/cassa/cassa.component.ts(8,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.

Try to fix that, and it should compile, or at least you would get another error