Skip to content

Conversation

@andrey-pavlenko
Copy link

@andrey-pavlenko andrey-pavlenko commented Jun 1, 2024

A convenient tool for me, thank you!
But if I specify the path to the directory (ex pugserver html/), an error occurs:

Error: listen EADDRINUSE: address already in use /usr/bin/node
    at Server.setupListenHandle [as _listen2] (node:net:1881:21)
    at listenInCluster (node:net:1946:12)
    at Server.listen (node:net:2061:5)
    at Object.<anonymous> (/mnt/data/Develope/qq-webcomponent-vs-iframe/node_modules/.pnpm/pugserver@1.1.1/node_modules/pugserver/pugserver.js:24:6)
    at Module._compile (node:internal/modules/cjs/loader:1434:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1518:10)
    at Module.load (node:internal/modules/cjs/loader:1249:32)
    at Module._load (node:internal/modules/cjs/loader:1065:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:12)
    at node:internal/main/run_main_module:30:49
Emitted 'error' event on Server instance at:
    at emitErrorNT (node:net:1925:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'EADDRINUSE',
  errno: -98,
  syscall: 'listen',
  address: '/usr/bin/node',
  port: -1
}

because the variables take these values { port: '/usr/bin/node', pugPath: 'html/' }.

I made the following changes:

  • Add commander package
  • Move code to startServer function

Now arguments can be passed in any order and the arguments still have their default values.

* Add commander package
* Move code to `startServer` function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant