LiaScript / LiaScript-Exporter

Export LiaScript courses into SCORM1.2 & 2004, IMS, PDF or a standalone WEB project ...
BSD 3-Clause "New" or "Revised" License
19 stars 2 forks source link

Installation fails on Ubuntu 22.04.2 LTS #45

Closed eguvep closed 3 weeks ago

eguvep commented 3 weeks ago

Thanks for this revolutionary peace of software – I love it!

Unfortunately, some students still want to use a pdf for taking notes, because they are used to do it that way. So I tried to install the exporter with:

sudo npm install -g --verbose https://github.com/liaScript/LiaScript-Exporter

Unfortunately, this fails with:

npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/liaScript/LiaScript-Exporter.git
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Konnte nicht vom Remote-Repository lesen.
npm ERR! 
npm ERR! Bitte stellen Sie sicher, dass die korrekten Zugriffsberechtigungen bestehen
npm ERR! und das Repository existiert.
npm verb exit 128

Regards! -- Peter

andre-dietrich commented 3 weeks ago

Thanks, Peter ...

you can try this one

sudo npm install -g --verbose @liascript/exporter

this will install the exporter from npm. We have to check why the other option does not work anymore ...

I hope this works for you?

Best, André

eguvep commented 3 weeks ago

Thanks a lot for the quick reply! The suggested option is doing a lot of stuff, but finally also quitting with some errors. Find the log file here: npm_lia_exp.log -- Peter

andre-dietrich commented 3 weeks ago

Hi, looks like puppeteer could not be installed, did you use sudo npm ... to install or without sudo?

What node and npm version are you using?

npm -v

eguvep commented 3 weeks ago

Yes, I tried sudo npm install -g --verbose @liascript/exporter Get the same error on two different computers (see below). I am using node v12.22.9 and npm v8.5.1

npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/@liascript/exporter/node_modules/puppeteer
npm ERR! command failed
npm ERR! command sh -c node install.mjs
npm ERR! file:///usr/local/lib/node_modules/@liascript/exporter/node_modules/puppeteer/install.mjs:31
npm ERR!   const {downloadBrowser} = await importInstaller();
npm ERR!                             ^^^^^
npm ERR! 
npm ERR! SyntaxError: Unexpected reserved word
npm ERR!     at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
npm ERR!     at async link (internal/modules/esm/module_job.js:42:21)
eguvep commented 3 weeks ago

Without sudo I get:

npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules'
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.
andre-dietrich commented 3 weeks ago

Can you try to upgrade your node version with n:

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

and then retry?

eguvep commented 3 weeks ago

I did that, and the installation worked fine. I still had to do:

sudo chmod +x /usr/local/lib/node_modules/@liascript/exporter/dist/index.js
cd ~/.cache/puppeteer
npx @puppeteer/browsers install chrome@127.0.6533.88

to downgrade chrome to the desired version. Then

liaex -i EnergiespeicherVEP_A.md --format pdf --output Energiespeicher.pdf

was running some time and asked me to be patient, finally produced a pdf ... that was just a blanc page, though :-(

andre-dietrich commented 3 weeks ago

what do you see, when you run:

liaex -i EnergiespeicherVEP_A.md --format pdf --output Energiespeicher --pdf-preview

this should open the browser and display the content ...

eguvep commented 3 weeks ago

I see a blank page.

andre-dietrich commented 3 weeks ago

That was a hard one .... the parcel bundler we use applied a regular expression to check for the origin of an URL

/(https?|file|ftp|(chrome|moz|safari-web)-extension):\/\/[^\/]+)/

this works well for file://foo.bar, but not for the root file:/// ... that is why nothing was loaded or executed at all ...

I changed this manually at the moment and updated it ... This should work now.

Puppeteer has also been update to the latest version ... which should not require a manual installation ... next to some minor fixes ....

if you are using your courses on github, you could try to run the following workflow:

https://github.com/LiaScript/docs/blob/master/.github/workflows/deploy.yaml

I added this for testing purposes ... the output is stored as a release in the project:

https://github.com/LiaScript/docs/releases/tag/latest

... Hope it works for you too ... now ...

eguvep commented 3 weeks ago

Thanks a lot for that very quick fix and for the CI workflow! Export is working perfectly now. LiaScript is - by far - the most efficient tool for creating contemporary learning material, I know!