RangeError: "port" argument must be >= 0 and < 65536

Good morning,
I found a problem with the application I’m uploading on your web portal.

The url of my project is https://glitch.com/edit/#!/piscostore and I see the error you find in the screenshoot.
Can you help us? Thank you.

It looks like the call to listen() in your case is not receiving a number as an argument. I’m not an expert on Babel, but it appears that you need to tell it what port it is supposed to open for the server. You should pass it the value found in process.env.PORT.

1 Like

The code is here, but i don’t find a error in the code :confused:

presets: [‘latest’, ‘react’],
plugins: [‘transform-class-properties’],

// ===== MODULES ===============================================================
const app = require(’…/app’);
const http = require(‘http’);

// Create HTTP server.
const server = http.createServer(app);

// Normalize a port into a number, string, or false.
const normalizePort = (val) => {
const port = parseInt(val, 10);

if (isNaN(port)) {
// named pipe
return val;

if (port >= 0) {
// port number
return port;

return false;

// Get port from environment and store in Express.
const port = normalizePort(process.env.PORT || ‘3000’);
app.set(‘port’, port);

// Event listener for HTTP server “error” event.
const onError = (error) => {
if (error.syscall !== ‘listen’) {
throw error;

const bind = typeof port === ‘string’
? ‘Pipe ${port}’
: ‘Port ${port}’;

// handle specific listen errors with friendly messages
switch (error.code) {
case ‘EACCES’:
console.error(’${bind} requires elevated privileges’);
console.error(’${bind} is already in use’);
throw error;

// Event listener for HTTP server “listening” event.
const onListening = () => {
const addr = server.address();
const bind = typeof addr === ‘string’
? ‘Pipe ${addr}’
: ‘Port ${addr.port}’;
console.log(‘Listening on ${bind}’);

// Listen on provided port, on all network interfaces.
server.on(‘error’, onError);
server.on(‘listening’, onListening);

I think if you log port to the console where server.listen is called, you’ll find that it isn’t a valid number. I would then add more logging to try to figure out where the port is getting an invalid value.

Good morning, I’ve solved by setting the door values manually.

I’m developing an advanced chatbot Facebook that can be very useful to our colleagues.

I found a problem on my “piscostore” project I see the changes in my .jsx files, but then the application does not include these changes. How can I “recompile” or “update in real time” the code on .jsx files?