Welcome to the Linux Foundation Forum!

Mock services bicycle and brand service.js not able to run error

environment: windows 10 pro without any framework (fastify or express)

when i set up both services under a new folder and try to run through nodejs command prompt i get error
C:\Users\santoshsub\nodejsstuff\aggregationserv>set PORT=4000;

C:\Users\santoshsub\nodejsstuff\aggregationserv>node bicycle-service.js
node:events:368
throw er; // Unhandled 'error' event
^

Error: listen EACCES: permission denied 4000;
←[90m at Server.setupListenHandle [as _listen2] (node:net:1317:21)←[39m
←[90m at listenInCluster (node:net:1382:12)←[39m
←[90m at Server.listen (node:net:1480:5)←[39m
at Object. (C:\Users\santoshsub\nodejsstuff\aggregationserv\bicycle-service.js:35:8)
←[90m at Module._compile (node:internal/modules/cjs/loader:1101:14)←[39m
←[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)←[39m
←[90m at Module.load (node:internal/modules/cjs/loader:981:32)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)←[39m
←[90m at node:internal/main/run_main_module:17:47←[39m
Emitted 'error' event on Server instance at:
←[90m at emitErrorNT (node:net:1361:8)←[39m
←[90m at processTicksAndRejections (node:internal/process/task_queues:83:21)←[39m {
code: ←[32m'EACCES'←[39m,
errno: ←[33m-4092←[39m,
syscall: ←[32m'listen'←[39m,
address: ←[32m'4000;'←[39m,
port: ←[33m-1←[39m
}

i have tried all different no for ports but its not working. if i dont set port server chooses a random port which i am unable to access via browser with that random port. kindly suggest what could be some possible solutions

thanks

Comments

  • I just wonder if you posted in the wrong forum. My labs don't have any bicycle service files. I have boat and brand services in chapter 7 lab 1, and that's it. As for the error, looks like there's some problem with the port.

  • @santoshsub123 did this happen with every port you tried or did you only try port 4000?

    if it's only happening with port 4000, it means a service on your machine is using that port
    if it's happening for every port, then you have a system configuration issue, possibly a virus checker, firewall program or VPN manager has locked down all port access.

Categories

Upcoming Training