Closed tmaster8 closed 5 years ago
Hi @tmaster8,
Thank you very much for your time, let's investigate this problem. Could you please tell me which operating system and the version number of it?
Did this error happen following the Wazuh API installation guide? Wazuh installation guide. Inside the previous link we must choose our operating system and follow the specified steps.
In any case I wait for your answer so I can help you with this problem.
Best regards, Adri
@AdriiiPRodri Amazon AMI Linux 2. yes this error happened following the guide.
I see, let's see why this can happen in your system, can you please run these commands and show me the output?
node --version
npm -g ls --depth=0
When you installed node, did you do it as root user?
@AdriiiPRodri I assume it has to do with http-auth? Yes I installed it as a root user
Yes, it has to do with that module. I see that the current version of node installed on your system is node 6.17.1. I recommend you install version 8.x of node. In any case we are going to try to solve it, let's execute the following command and see what it returns to us:
ls -lth /var/ossec/api/node_modules/
@AdriiiPRodri
Ok @tmaster8, the module seems to be correct in your installation, however let's try the following:
1º Let's remove the module from the API:
rm -r /var/ossec/api/node_modules/http-auth/
2º Now we will reinstall the module:
npm install --prefix /var/ossec/api http-auth
3º Restart the API and check if the error persists
@AdriiiPRodri Problem still persists
All right, it looks like everything is right, let's try running the following:
npm config set user 0
And then restart the API
@AdriiiPRodri
Let's go to the path /var/ossec/api:
cd /var/ossec/api
And run the following command to be able to check that its output is correct:
npm install
@AdriiiPRodri I wish it gave me a better error message....
I think this may be happening in another part of the code. Let's do one:
ls -lth /var/ossec/api/helpers
And we'll see if everything is correct in this folder.
@AdriiiPRodri
All right in this folder, let's see the contents of the http-auth folder:
ls -lth /var/ossec/api/node_modules/http-auth
And then:
ls -lth /var/ossec/api/node_modules/http-auth/src
@AdriiiPRodri
Ok @tmaster8, I see that the permissions on these files are not correct. Let's do the following, as a root user we will execute the following commands:
rm -rf /var/ossec/api/node_modules/*
After this we are going to do the following:
cd /var/ossec/api
The next thing is to reinstall all dependencies:
npm install
Finally, we restart the API
@AdriiiPRodri new error code
This is unusual, we are going to confirm that everything has gone correctly. Let's list the elements of /var/ossec/api/node_modules:
ls -lth /var/ossec/api/node_modules
@AdriiiPRodri
@AdriiiPRodri Nvm I figured it out! Thanks for the help!
Great @tmaster8, I'm so glad I helped you. In order to help other users, you could tell me what the error was, have you installed nvm, have you changed the version of node?
@AdriiiPRodri after following all your steps, I just completely uninstalled and re-installed the wazuh-api via yum
and I know this is the error handling for app.js