BanManagement / BanManager-WebAPI

HTTP GraphQL API
MIT License
6 stars 1 forks source link

Setup doesnt work #139

Closed arriej closed 5 years ago

arriej commented 5 years ago

First of all i'm aware this this is project in development. I wanted to give this feature a little test along with the new web panel.

I've setup a sub domain (api.salyfactory) for the API, running with Plesk. Enabled nodejs on the machine. The install works well after adding a ".npmrc" file in the root directory of the project. the file contains: "scripts-prepend-node-path=true"

I have to do this to avoid the error "no node binary in the current PATH" After that install trough plesk i want to execute the setup with "node bin/bm-cli setup"

However i get the following error:

-sh-4.2$ node bin/bm-cli setup
/var/www/vhosts/salyfactory.com/api.salyfactory.com/cli/commands/encrypt.js:11
exports.handler = async function () {
                        ^^^^^^^^
SyntaxError: Unexpected token function
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at Object.require (internal/module.js:20:19)
    at /var/www/vhosts/salyfactory.com/api.salyfactory.com/node_modules/require-directory/index.js:76:17

I tried to run this as the domain user. Or root. Both come up with the same error.

When i run the "setup" script trough the plesk app it somewhat works. but i cant fill anything in there. i get the following output:


bm-api@1.0.0 setup /var/www/vhosts/salyfactory.com/api.salyfactory.com
node bin/bm-cli setup

Starting setup
If unsure, use default
? BanManager UI Site Hostname (http://localhost:3000)

I'm out of ideas on how to continue setting the api up.

Versions: Node.js: 12.4.0

Thanks in advance! love your work dude!

confuser commented 5 years ago

Hi, nice to see someone trying to use it 😄

With regards to the error, are you sure you're running Node.js 12.4.0? The error you've shared looks like it doesn't like async which suggests it's running against a pre v8 Node.js version

arriej commented 5 years ago

That makes alot of sense. When i type in node -v on console it comes up with version 6.17.1. But on the plesk control panel it tells me its version 12. explains why it trough the panel it does(somewhat ) work and cmd doesnt. Let me figure out how to install version 12. instead of 6 on this plesk machine.

Thanks

confuser commented 5 years ago

@arriej presuming it's resolved? Open to feedback to improving the setup process as well, as I know it's not great when going down the container route at the moment.

arriej commented 5 years ago

The issue with nodejs was purely on my side. On plesk I use the nodejs app. If put it up on the machine my server runs on, it would have been easier regarding node. For some reason it doesnt use the same nodesj with cmd.

I have a few options in plesk: https://gyazo.com/16a606467e65d08cd34e60237b39682c

the setup is different on this page: https://banmanagement.com/setup then the one on the readme on the project. Can only assume that the guide on the /setup is slightly outdates (the info given there regarding the setup is really usefull. )

When it comes to the pasting part it says its openeing a text editor. But i mainly use nano (yeah basic pleb i know >.<) but had to install vim else the setup crashed and had to restart. So maybe ass a requirement to have vim installed?

confuser commented 5 years ago

https://banmanagement.com/setup is the most up-to-date, I'll add a note about requiring vim