SolidLabResearch / Solid-Agent

A rule-based intelligent software agent
8 stars 1 forks source link

problem with parsing expression #14

Open rosshorne opened 1 month ago

rosshorne commented 1 month ago

Hi @woutslabbinck When trying to run I get stuck (I use default Ubuntu LTS packages). See below. Any suggestions would be much appreciated. Best, Ross

Command: npx community-solid-server -c memory-no-setup.json

Response: /root/Solid-Agent/node_modules/@solid/access-token-verifier/dist/algorithm/parseSolidAuthorizationHeader.js:14 const [match, joseHeader, jwsPayload, jwsSignature] = /^(?:DPoP|Bearer) +([\w-~+/]+).([\w-~+/]+).([\w-~+/]+)(?:=+)?$/i.exec(authorizationHeader) ?? [];

                               ^

SyntaxError: Unexpected token '?' at wrapSafe (internal/modules/cjs/loader.js:915:16) at Module._compile (internal/modules/cjs/loader.js:963:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/root/Solid-Agent/node_modules/@solid/access-token-verifier/dist/algorithm/verifySolidAccessToken.js:11:41) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

Alternatively, I get:

Command: npx community-solid-server -c @css:config/file-no-setup.json -f ./.data

Response: /root/Solid-Agent/node_modules/@solid/access-token-verifier/dist/algorithm/parseSolidAuthorizationHeader.js:14 const [match, joseHeader, jwsPayload, jwsSignature] = /^(?:DPoP|Bearer) +([\w-~+/]+).([\w-~+/]+).([\w-~+/]+)(?:=+)?$/i.exec(authorizationHeader) ?? [];

                               ^

SyntaxError: Unexpected token '?' at wrapSafe (internal/modules/cjs/loader.js:915:16) at Module._compile (internal/modules/cjs/loader.js:963:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/root/Solid-Agent/node_modules/@solid/access-token-verifier/dist/algorithm/verifySolidAccessToken.js:11:41) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

woutslabbinck commented 1 month ago

Hey Ross,

I have done a clean install following the instructions of installing

git clone https://github.com/SolidLabResearch/Solid-Agent.git
cd Solid-Agent
npm i

And then running the actual demo of UCP Terminal 1 (hosting CSS, a solid server)

npx community-solid-server -c memory-no-setup.json

Terminal 2 (running the Solid Agent)

npx ts-node indexUCP.ts

Terminal 3 (adding a policy)

curl --data "@./rules/usage-control/durationPermissionPolicy.ttl" http://localhost:3000/policies -H "content-type: text/turtle"

And all seemed to work fine, so I can not recreate your error.

May I ask you which NodeJS version you are running? Perhaps that might be the underlying cause.

I am doing all of this with node version v18.18.2 by executing node -v in my terminal. (I am also using Ubuntu LTS)

I know that the package that gives the error (@solid/access-token-verifier) depends on a node version of at least 14 due to Nullish coalescing. So an earlier version of NodeJS might lead to the CSS version 5 not starting.

rosshorne commented 1 month ago

OK. I'm on node -v: "v12.22.9" (the Ubuntu LTS default). That could well be the problem.