Product/components used and version/fix level:
@c8y/cli
Detailed explanation of the problem:
I am trying to run through some web development tutorials (which previously worked earlier this year) for our current project, and we noticed that there are internal server errors and it appears that it has to do with the source code. ’
I have run other versions when compiling and the error still persists.
It appears to have something to do with the split function in an index.js file.
I’ve downloaded the correct version of NodeJS, we have tried to npm install --legacy-peer-deps after deleting the node_modules and the error still persisted.
I have tried to include as much information as possible to help gauge the issue, and if you need to see anything else I will do my best to provide it.
UPDATE: It doesn’t initially provide these errors or when I try to login when I start the server through the package.json file with npm run start.
Error messages / full error message screenshot / log file:
When running server:
Warning: Dependency ngx-bootstrap cannot be resolved for module federation sharing.
http://localhost:9000/apps/tutorial-application/ 10 % - building - 0/1 entries 66/71 dependencies 25/47 modules
http://localhost:9000/apps/tutorial-application/ 99 % - cache - begin idle
Entrypoint bootstrap 1.51 MiB = bootstrap.js
Chunk Group app 981 KiB = vendors-node_modules_zone_js_dist_zone_js-node_modules_angular_platform-browser_fesm2020_anim-3c6a33.js 967 KiB app.js 14.3 KiB
Chunk Group branding =
webpack 5.76.1 compiled successfully in 11804 ms
http://localhost:9000/apps/tutorial-application/ done - finished in 11 s - 876.764 ms
When opening the link to the server:
TypeError: Cannot read properties of null (reading 'split')
at required (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\requires-port\index.js:13:23)
at Object.common.setupOutgoing (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy\lib\http-proxy\common.js:101:7)
at Array.stream (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy\lib\http-proxy\passes\web-incoming.js:127:14)
at ProxyServer.<anonymous> (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy\lib\http-proxy\index.js:81:21)
at HttpProxyMiddleware.middleware (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy-middleware\dist\http-proxy-middleware.js:22:32)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
TypeError: Cannot read properties of null (reading 'split')
at required (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\requires-port\index.js:13:23)
at Object.common.setupOutgoing (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy\lib\http-proxy\common.js:101:7)
at Array.stream (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy\lib\http-proxy\passes\web-incoming.js:127:14)
at ProxyServer.<anonymous> (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy\lib\http-proxy\index.js:81:21)
at HttpProxyMiddleware.middleware (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy-middleware\dist\http-proxy-middleware.js:22:32)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
TypeError: Cannot read properties of null (reading 'split')
at required (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\requires-port\index.js:13:23)
at Object.common.setupOutgoing (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy\lib\http-proxy\common.js:101:7)
at Array.stream (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy\lib\http-proxy\passes\web-incoming.js:127:14)
at ProxyServer.<anonymous> (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy\lib\http-proxy\index.js:81:21)
at HttpProxyMiddleware.middleware (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy-middleware\dist\http-proxy-middleware.js:22:32)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
TypeError: Cannot read properties of null (reading 'split')
at required (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\requires-port\index.js:13:23)
at Object.common.setupOutgoing (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy\lib\http-proxy\common.js:101:7)
at Array.stream (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy\lib\http-proxy\passes\web-incoming.js:127:14)
at ProxyServer.<anonymous> (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy\lib\http-proxy\index.js:81:21)
at HttpProxyMiddleware.middleware (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy-middleware\dist\http-proxy-middleware.js:22:32)
When entering login information:
And this is the server response to this:
at processTicksAndRejections (node:internal/process/task_queues:96:5)
TypeError: Cannot read properties of null (reading 'split')
at required (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\requires-port\index.js:13:23)
at Object.common.setupOutgoing (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy\lib\http-proxy\common.js:101:7)
at Array.stream (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy\lib\http-proxy\passes\web-incoming.js:127:14)
at ProxyServer.<anonymous> (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy\lib\http-proxy\index.js:81:21)
at HttpProxyMiddleware.middleware (C:\Users\username\OneDrive - Novanta\Documents\Project test\Cumulocity\Web Dev Tutorials\tutorial-application\node_modules\http-proxy-middleware\dist\http-proxy-middleware.js:22:32)
The index.js file code:
'use strict';
/**
* Check if we're required to add a port number.
*
* @see https://url.spec.whatwg.org/#default-port
* @param {Number|String} port Port number we need to check
* @param {String} protocol Protocol we need to check against.
* @returns {Boolean} Is it a default port for the given protocol
* @api private
*/
module.exports = function required(port, protocol) {
protocol = protocol.split(':')[0];
port = +port;
if (!port) return false;
switch (protocol) {
case 'http':
case 'ws':
return port !== 80;
case 'https':
case 'wss':
return port !== 443;
case 'ftp':
return port !== 21;
case 'gopher':
return port !== 70;
case 'file':
return false;
}
return port !== 0;
};