Ziti Admin Console nodejs problem

Hi everyone:

I am new using Openziti.
When I create ziti admin console and run following code, it shows some errors.
Could could please share some idea to solve it?

Thank you very much

user@user-virtual-machine:~/.ziti/quickstart/user-virtual-machine/ziti-console$ node "${ZITI_HOME}/ziti-console/server.js"
node:fs:590
handleErrorFromBinding(ctx);
^

Error: ENOENT: no such file or directory, open '/home/user/.ziti/quickstart/user-virtual-machine/ziti-console/dist/ziti-console-lib/assets/templates/header.htm'
at Object.openSync (node:fs:590:3)
at Object.readFileSync (node:fs:458:35)
at file:///home/user/.ziti/quickstart/user-virtual-machine/ziti-console/server.js:84:17 {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/home/user/.ziti/quickstart/user-virtual-machine/ziti-console/dist/ziti-console-lib/assets/templates/header.htm'
}
user@user-virtual-machine:~/.ziti/quickstart/user-virtual-machine/ziti-console$ npm -v
8.19.4
user@user-virtual-machine:~/.ziti/quickstart/user-virtual-machine/ziti-console$ nodejs -v
Command 'nodejs' not found, but can be installed with:
sudo apt install nodejs
user@user-virtual-machine:~/.ziti/quickstart/user-virtual-machine/ziti-console$ node -v
v16.20.2
user@user-virtual-machine:~/.ziti/quickstart/user-virtual-machine/ziti-console$

Hi @Jheng, did you follow the ZAC quickstart exactly as outlined? That looks to me like somehow the "build the angular app" step was missed? Did you maybe pull recently and miss that the app build process changed slightly?

image

Did that succeed for you? @rgalletto fyi

I can build ng but I can create ng but it gives an error message

pm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/lib/node_modules/@angular
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/@angular'
npm ERR! at async mkdir (node:internal/fs/promises:859:10)
npm ERR! at async /usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:546:20
npm ERR! at async Promise.allSettled (index 0)
npm ERR! at async [reifyPackages] (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:246:11)
npm ERR! at async Arborist.reify (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:165:5)
npm ERR! at async Install.exec (/usr/lib/node_modules/npm/lib/commands/install.js:153:5)
npm ERR! at async module.exports (/usr/lib/node_modules/npm/lib/cli-entry.js:61:5)
npm ERR! Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/@angular'
npm ERR! at async mkdir (node:internal/fs/promises:859:10)
npm ERR! at async /usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:546:20
npm ERR! at async Promise.allSettled (index 0)
npm ERR! at async [reifyPackages] (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:246:11)
npm ERR! at async Arborist.reify (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:165:5)
npm ERR! at async Install.exec (/usr/lib/node_modules/npm/lib/commands/install.js:153:5)
npm ERR! at async module.exports (/usr/lib/node_modules/npm/lib/cli-entry.js:61:5) {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/lib/node_modules/@angular'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in: /home/user/.npm/_logs/2024-03-19T08_56_37_049Z-debug-0.log

run node "${ZITI_HOME}/ziti-console/server.js"

{
edgeControllers: ,
bindIP: '',
editable: true,
update: false,
location: '../ziti',
port: 1408,
portTLS: 8443,
logo: '',
primary: '',
secondary: '',
allowPersonal: true,
rejectUnauthorized: false,
mail: { host: '', port: 25, secure: false, auth: { user: '', pass: '' } },
from: '',
to: ''
}
TLS initialized on port: 8443
(node:31037) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
Ziti Admin Console is now listening on port 1408

May I ask which step I made wrong?

node 21.7.1
npm 10.5.0

1 Like

You need to read the error messages more closely. It looks like you have permission problems?

npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

Yes,I'm just checking again to see if it's a permissions issue.
Because I added sudo before, it was ok.

punycode module has been deprecated
How should I correct him?

it's up to you as to the proper way to correct it... if it were me, I'd probably remove the cloned repo, reclone it and try again. but you can chmod it if you want, there are lots of ways. I don't think I can tell you "the one way" to do it

OK
Let me think about it and try again
Thanks

{
edgeControllers: ,
bindIP: '',
editable: true,
update: false,
location: '../ziti',
port: 1408,
portTLS: 8443,
logo: '',
primary: '',
secondary: '',
allowPersonal: true,
rejectUnauthorized: false,
mail: { host: '', port: 25, secure: false, auth: { user: '', pass: '' } },
from: '',
to: ''
}
TLS initialized on port: 8443
(node:8699) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
Port 1408 In Use, Attempting new port 1409
TLS initialized on port: 8443
node:events:497
throw er; // Unhandled 'error' event
^

Error: listen EADDRINUSE: address already in use :::8443
at Server.setupListenHandle [as _listen2] (node:net:1897:16)
at listenInCluster (node:net:1945:12)
at Server.listen (node:net:2037:7)
at StartServer (file:///home/user/.ziti/quickstart/user-virtual-machine/ziti-console/server.js:2046:15)
at file:///home/user/.ziti/quickstart/user-virtual-machine/ziti-console/server.js:1978:1
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1924:8)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'EADDRINUSE',
errno: -98,
syscall: 'listen',
address: '::',
port: 8443
}

Node.js v21.7.1

Sorry, I want to ask. After reinstalling and running server.js, the following situation occurred. I don’t know if it is correct.
Can you help me?
Thanks

Based on the console logs, the ZAC server should be up and running. If you try to access the console via http:// on port 1409, or https:// on port 8443, I expect you should be able to login.

There does appear to be a minor bug in the startup script for server.js which is what is causing the error logs you're seeing. Basically, if the server has to retry starting on a different port than the default (ie. 1408 -> 1409 based on your logs) it will also retry the TLS port again as well. Since the server was already able to initialize on 8443 the first time, it then threw an error on the second attempt since the address was already in use.

We'll get this retry logic cleaned up, but in the meantime your ZAC should hopefully be up and running. Let us know though if you're still having issues.

After reinstalling and running server.js, the following situation occurred.

@Jheng also just one other question.. do you still have a previous instance of ZAC running already? Or maybe another program that's running on port 1408? If so, you might also want to try shutting the other instance down first before running the latest.