Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken build for Angular apps #10242

Closed
deepu105 opened this issue Aug 18, 2019 · 4 comments

Comments

@deepu105
Copy link
Member

commented Aug 18, 2019

Overview of the issue

The Angular application webpack build seems broken in master

> store@0.0.1-SNAPSHOT webpack /home/deepu/Documents/jhipster-book/v2/Chapters/3/code/online-store
> node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js "--config" "webpack/webpack.dev.js" "--env.stats=minimal"

Webpack: Starting ...
Starting type checking service...
Webpack: Starting ...

   ✔ Compile modules
   ✔ Build modules
   ✔ Optimize modules
   ✔ Emit files

Webpack: Finished after 7.169 seconds.
> :webpackBuildDev
 ERROR  Failed to compile with 1 errors3:47:04 PM

 error  in ./src/main/webapp/app/app-routing.module.ts

Module parse failed: Unexpected token (16:40)
File was processed with these loaders:
 * ./node_modules/angular2-template-loader/index.js
 * ./node_modules/cache-loader/dist/cjs.js
 * ./node_modules/thread-loader/dist/cjs.js
 * ./node_modules/ts-loader/index.js
 * ./node_modules/angular-router-loader/src/index.js
 * ./node_modules/eslint-loader/index.js
You may need an additional loader to handle the result of these loaders.
|                 {
|                     path: 'admin',
>                     loadChildren: () => import('./admin/admin.module').then(m => m.StoreAdminModule)
|                 },
|                 ...LAYOUT_ROUTES

 @ ./src/main/webapp/app/app.module.ts 16:0-61 52:12-33
 @ ./src/main/webapp/app/app.main.ts

   605 modules

ERROR in ./src/main/webapp/app/app-routing.module.ts 16:40
Module parse failed: Unexpected token (16:40)
File was processed with these loaders:
 * ./node_modules/angular2-template-loader/index.js
 * ./node_modules/cache-loader/dist/cjs.js
 * ./node_modules/thread-loader/dist/cjs.js
 * ./node_modules/ts-loader/index.js
 * ./node_modules/angular-router-loader/src/index.js
 * ./node_modules/eslint-loader/index.js
You may need an additional loader to handle the result of these loaders.
|                 {
|                     path: 'admin',
>                     loadChildren: () => import('./admin/admin.module').then(m => m.StoreAdminModule)
|                 },
|                 ...LAYOUT_ROUTES
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! store@0.0.1-SNAPSHOT webpack: `node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js "--config" "webpack/webpack.dev.js" "--env.stats=minimal"`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the store@0.0.1-SNAPSHOT webpack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/deepu/.npm/_logs/2019-08-18T13_47_04_545Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! store@0.0.1-SNAPSHOT webpack:build:main: `npm run webpack -- --config webpack/webpack.dev.js --env.stats=minimal`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the store@0.0.1-SNAPSHOT webpack:build:main script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/deepu/.npm/_logs/2019-08-18T13_47_04_555Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! store@0.0.1-SNAPSHOT webpack:build: `npm run cleanup && npm run webpack:build:main`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the store@0.0.1-SNAPSHOT webpack:build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/deepu/.npm/_logs/2019-08-18T13_47_04_566Z-debug.log

> Task :webpackBuildDev FAILED

FAILURE: Build failed with an exception.

Reproduce the error

Run ./gradlew on the generated app

JHipster Version(s)
JHipster configuration
JHipster Version(s)
store@0.0.1-SNAPSHOT /home/deepu/Documents/jhipster-book/v2/Chapters/3/code/online-store
└── generator-jhipster@6.2.0 

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.mycompany.store",
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "6.2.0",
    "applicationType": "monolith",
    "baseName": "store",
    "packageName": "com.mycompany.store",
    "packageFolder": "com/mycompany/store",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "hazelcast",
    "enableHibernateCache": true,
    "websocket": "spring-websocket",
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "gradle",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "",
    "useSass": true,
    "clientPackageManager": "npm",
    "clientFramework": "angularX",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "testFrameworks": [
      "protractor"
    ],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en",
      "zh-cn"
    ],
    "blueprints": []
  }
}
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

Environment and Tools

openjdk version "1.8.0_212"
OpenJDK Runtime Environment (Zulu 8.38.0.13-CA-linux64) (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (Zulu 8.38.0.13-CA-linux64) (build 25.212-b04, mixed mode)

git version 2.21.0

node: v10.13.0

npm: 6.4.1

yeoman: 2.0.0

yarn: 1.17.3

Docker version 19.03.1, build 74b1e89

docker-compose version 1.22.0, build f46880f

Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)
@deepu105

This comment has been minimized.

Copy link
Member Author

commented Aug 18, 2019

@wmarques @vishal423 guys any idea what broke this? the Travis builds seem fine though, which is strange

@deepu105 deepu105 changed the title Broke build for Angular apps Broken build for Angular apps Aug 18, 2019

@deepu105

This comment has been minimized.

Copy link
Member Author

commented Aug 18, 2019

Seems related to angular/angular-cli#14566

@deepu105

This comment has been minimized.

Copy link
Member Author

commented Aug 18, 2019

Following this fixed the issue, since the project had an old package-lock

rm package-lock.json
rm -rf node_modules
npm i

@deepu105 deepu105 closed this Aug 18, 2019

@amirdt22

This comment has been minimized.

Copy link
Contributor

commented Aug 30, 2019

Alternative is to use "webpack": "4.35.3" in package.json, looks like already taken care of in master

@pascalgrimaud pascalgrimaud added this to the 6.3.0 milestone Sep 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.