EatTheBlocks Forum

Webpack-dev-server error (Day 4)

HI there, i’m having issues running the command npm start for the frontend of Day 4: Advanced Storage.
I’m on Windows 10 and I get the following error:

> webpack-dev-server

      throw er; // Unhandled 'error' event

Error: listen EACCES: permission denied
    at Server.setupListenHandle [as _listen2] (net.js:1292:21)
    at listenInCluster (net.js:1357:12)
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1496:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:69:10)
Emitted 'error' event on Server instance at:
    at emitErrorNT (net.js:1336:8)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  code: 'EACCES',
  errno: -4092,
  syscall: 'listen',
  address: '',
  port: 8080
npm ERR! errno 1
npm ERR! day4-advanced-storage@1.0.0 start: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the day4-advanced-storage@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

and from the log:

10 silly lifecycle day4-advanced-storage@1.0.0~start: Args: [ '/d /s /c', 'webpack-dev-server' ]
11 silly lifecycle day4-advanced-storage@1.0.0~start: Returned: code: 1  signal: null
12 info lifecycle day4-advanced-storage@1.0.0~start: Failed to exec start script
13 verbose stack Error: day4-advanced-storage@1.0.0 start: `webpack-dev-server`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:321:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\...\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:321:20)
13 verbose stack     at maybeClose (internal/child_process.js:1028:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
18 verbose node v13.6.0
19 verbose npm  v6.13.6

Thanks for any thoughts,

Try to change the port in webpack.config.js, for example 3000, and restart server:

const path = require('path');

module.exports = {
  mode: 'development',
  entry: './client/index.js',
  output: {
    path: path.resolve(__dirname, 'public'),
    filename: 'bundle.js', // string
  devServer: {
    contentBase: path.join(__dirname, 'public'),
    compress: true,
    port: 3000 //this has been changed

Thanks, that worked a treat :+1: