freecouch
freecouch

Reputation: 233

yarn start fails after jhipster 5.0.1 upgrade

I've generated a JHipster / React app and after upgrading JHipster to 5.0.1 (from 5.0.0-beta.1) and running jhipster upgrade, I get the following when I run yarn start:

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/

ERROR in multi (webpack)-dev-server/client?http://localhost:8081 ./src
Module not found: Error: Can't resolve './src' in '/Users/yvon/git/ods-jhipster-sns'
 @ multi (webpack)-dev-server/client?http://localhost:8081 ./src
ℹ 「wdm」: Failed to compile.

I tried generating a branch new jhipster app using the 5.0.1 generator, but yarn start fails at exactly the same spot.

Here's the relevant part of package.json:

  "scripts": {
"precommit": "lint-staged",
"prettier:format": "yarn prettier --write 'src/**/*.{ts,tsx,css,scss}'",
"lint": "tslint --project tsconfig.json -e 'node_modules/**'",
"lint:fix": "yarn run lint --fix",
"cleanup": "rimraf target/www",
"start": "yarn run webpack:dev",
"test": "yarn run lint && jest --coverage --logHeapUsage -w=2 --config src/test/javascript/jest.conf.js",
"test:watch": "yarn test --watch",
"webpack:dev": "yarn run webpack-dev-server --config webpack/webpack.dev.js --progress --inline --profile --port=9060",
"webpack:build:main": "yarn run webpack --config webpack/webpack.dev.js --progress --profile",
"webpack:build": "yarn run cleanup && yarn run webpack:build:main",
"webpack:prod:main": "yarn run webpack --config webpack/webpack.prod.js --profile",
"webpack:prod": "yarn run cleanup && yarn run webpack:prod:main",
"webpack:test": "yarn run test",
"webpack-dev-server": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"webpack": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js"},

and webpack-dev.js:

const webpack = require('webpack');
const writeFilePlugin = require('write-file-webpack-plugin');
const webpackMerge = require('webpack-merge');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const WebpackNotifierPlugin = require('webpack-notifier');
const path = require('path');

const utils = require('./utils.js');
const commonConfig = require('./webpack.common.js');

const ENV = 'development';

module.exports = webpackMerge(commonConfig({ env: ENV }), {
  devtool: 'cheap-module-source-map', // https://reactjs.org/docs/cross-origin-errors.html
  mode: 'development',
  entry: [
    'react-hot-loader/patch',
    './src/main/webapp/app/index'
  ],

Is JHipster/React 5.0.1 broken, or am I missing something obvious?

Upvotes: 1

Views: 464

Answers (1)

helleye
helleye

Reputation: 46

I had the same problem. Using the jhipster info command I found out that the version of yarn was too old. I upgraded to version 1.7. Now the Webpack server is running.

Upvotes: 3

Related Questions