5

Jhipster's http://www.jhipster.tech/installation/ allow to use either yarn or npm , on a different question Application generated with JHipster 4 returning blank page on 8080, but not on 9000 It is suggested to run yarn install and yarn webpack:build I am new to UI development and we are only allowed npm, so I want to know what will be the equivalent of yarn install and yarn webpack:build

I generated a new project with

D:\rajblog>jhipster --npm Using JHipster version installed globally Running default command Executing jhipster:app Options: npm: true

( not with "yo jhipster --npm"), it automatically called "npm install" , but when I run "npm webpack:build" , it does not run and I get

D:\rajblog>npm webpack:build

Usage: npm

where is one of:

and

D:\rajblog>npm webpack-build

Usage: npm

where is one of: access, adduser, bin, bugs, c, cache, completion, config, ddp, dedupe, deprecate, dist-tag, docs, doctor, edit, explore, get, help, help-search, i, init, install, install-test, it, link, list, ln, login, logout, ls, outdated, owner, pack, ping, prefix, profile, prune, publish, rb, rebuild, repo, restart, root, run, run-script, s, se, search, set, shrinkwrap, star, stars, start, stop, t, team, test, token, tst, un, uninstall, unpublish, unstar, up, update, v, version, view, whoami

npm -h quick help on npm -l display full usage info npm help search for help on npm help npm involved overview

Specify configs in the ini-formatted file: C:\Users\XXUid.npmrc or on the command line via: npm --key value Config info can be viewed via: npm help config

npm@5.5.1 D:\nodejs\node_modules\npm

Raj
  • 747
  • 1
  • 9
  • 19

2 Answers2

2

You could see defined scripts in your package.json file, for example:

"scripts": {
  "cleanup": "rimraf build/{aot,www}",
  "build": "yarn run webpack:prod",
  …
  "webpack:build:main": "yarn run webpack -- --config webpack/webpack.dev.js --progress --profile",
  "webpack:build": "yarn run cleanup && yarn run webpack:build:main",
  …
  "webpack": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js",

Based on this you could start webpack with following npm run command:

npm run cleanup && npm run webpack -- --config webpack/webpack.dev.js --progress --profile

Select script you want to use, e.g. webpack/webpack.dev.js or webpack/webpack.prod.js

Second approach would be to install webpack globally

npm install --global webpack

Run script as

webpack --config webpack/webpack.dev.js 
0

To use npm, you need to generate your project with --npm flag: jhipster --npm

Then, the commands are similar: npm install and npm webpack:build

Pascal Grimaud
  • 1,161
  • 1
  • 8
  • 9