Genie Community Forum

About the API

I see, so we can maybe we can just reuse our custom config.js file, add the new variables found in the current version of web Almond, and put them in the /etc/almond-cloud/config.js directory? I think last time we didn’t make any changes to the config.ts file directly.

We tried following the previous installation method, but found some problems when trying to run the step 2 installation, specifically the npm install command. He got an error as follows:


You can see that when running npm install in the almond-cloud directory, it says that it cannot find the file for chmod '/root/almond-cloud/node_modules/genie-toolkit/dist/tool/genie.js'. However, the genie command itself does exist and could be run as shown at the bottom of the screenshot. He found that the problem was that in the package.json file, the genie-toolkit entry doesn’t have a resolved variable as you can see as follows:

His solution was to add it with the path going to the .tgz file as follows:

After that, npm install could work fine as follows:

He told me that he got the idea from the stable-2-0 branch because it has the resolved variable there:

So maybe this is a problem in the master branch that isn’t handled yet?

No, you’re corrupting the package-lock.json if you do that, and you force almond-cloud to run against the wrong version of genie-toolkit. The resolved variable is missing because it’s a git dependency.

The real problem is that npm@6 has a bug when running as root (https://github.com/npm/cli/issues/2062). The issue was closed because npm is not actively maintained. npm@7 has a different set of issues with Typescript projects so it’s to be avoided. You’ll need to run npm as a regular user, not root.

I see, so first of all we need to make sure that the npm we install is a 6.* version. Then we also need to make sure that we are doing the installation as a normal user, not root. Is this correct?

Yeah. If you use the recommended version of node (==12.) it will come with npm 6. already.

Ok. What about the part for the config.js file? Can we ignore the config.ts file and just copy our previous config.js file to the /etc/almond-cloud/config.js directory? Maybe also look at the existing config.js file in the almond-cloud github and add the new variables found there (or is this not required)?

Edit:
We tried changing to a non root user and it had a different error as follows:





What my friend did instead was install go version 1.16.3 and it seemed to solve the issue for npm install as follows:

However, now we get an error for npm link as follows:

You can skip the npm link step, if instead of running almond-cloud you run node $path_to_almond_cloud/dist/main.js
(you can also make the symlink from /usr/bin to the right script in the almond-cloud repo yourself with sudo if you want)

I see, well we don’t mind having a few more words in the code. However, when I tried running the bootstrap step I got the following error:


What does this error mean?

Database configuration is not valid. Missing DATABASE_URL in the config?

I tried to use the config.js file found in stanford but I guess its better to use our existing one? I still get some other warnings when using that one though, as follows:
image
I think the database connection errors are because we haven’t set up the database correctly, but what about the unknown configuration key warnings? Those were variables included in our existing config file from the template last semester, do we just remove them?

Yeah you definitely need your configuration file, and then you can add the missing stuff from stanford/config.js as needed. And yeah some keys are no longer used, you can remove them or ignore the warning.

So we need to add the stuff from the stanford/config.js file as well? It wont automatically fill/overlap itself somehow?

Some keys are already there, you need to edit them. Or you just put the whole config.js in /etc/almond-cloud/config.d/ with some unique name, and it will be layered on top.

Ok, I think it would be easier if we just have one combined file in /etc/almond-cloud/config.js then. Is there a way to view the .pug files in their webpage form without waiting for the website to be deployed? Something like opening an html file in a local computer or running a website in the localhost.

For development, you can run ./tests/webalmond-integration.sh --interactive, it will spin up the whole server with a testing configuration and listen on port 7070.
You can then edit the pug files and refresh to see your changes.

Hmm, I see. I was looking for more of an option to edit and view the single page without having to worry about installing the almond-cloud in multiple computers, but I guess we can deal with this just fine. Just to clarify, this should work after we run the bootstrap command right? So we can then run ./tests/webalmond-integration.sh --interactive in that terminal and it should show the website on our configured url/port. Or in other words, this is different with running almond-cloud run-almond and almond-cloud run-frontend.

The test script is only for local development, it will bootstrap a separate instance with a test configuration. It is unrelated to any config or database you have.
If you want to test exactly your config, you can run the server as usual.

Oh so we can just install the necessary dependencies, clone the github, and run npm install? So it should work after step 2 in this case (just before copying the config file).

Or would this work by just cloning the github and then running the test script?

Clone the github, install the deps, run npm install (or better, npm ci), and run the test scripts and yeah it should work. Should, of course, is a magical word, given the length of this thread, but I really hope it will work for you!

Ok, we’ll try this out later then. Thanks for your help so far Giovanni.

It seems that we still have problems even though we have setup the database to be the same as last semester:


Do you have an idea of what could be causing this? It seems to come from the Almond file, not our external parts.