mwoffliner icon indicating copy to clipboard operation
mwoffliner copied to clipboard

Installation issue with npm i -g mwoffliner

Open Mewto7 opened this issue 1 year ago • 10 comments

I am using Lubuntu 22.04 LTS . I am trying to install with

sudo npm i -g mwoffliner

But I get this error:

kurisu@kurisu:~$ sudo npm i -g mwoffliner
[sudo] password for kurisu: 
npm WARN deprecated [email protected]: unmaintained
npm WARN deprecated [email protected]: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
npm WARN deprecated [email protected]: Use your platform's native DOMException instead
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
/usr/local/bin/mwoffliner -> /usr/local/lib/node_modules/mwoffliner/lib/cli.js
npm WARN lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/2310/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> @openzim/[email protected] install /usr/local/lib/node_modules/mwoffliner/node_modules/@openzim/libzim
> npm run download && node-gyp rebuild -v && npm run bundle

2024/05/18 23:00:34.376488 cmd_run.go:1072: WARNING: cannot create user data directory: cannot create snap home dir: mkdir /nonexistent: permission denied
Sorry, home directories outside of /home needs configuration.
See https://forum.snapcraft.io/t/11209 for details.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.2 (node_modules/mwoffliner/node_modules/jest-haste-map/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] requires a peer of typescript@>=3.4 <4.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of canvas@^2.5.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @openzim/[email protected] install: `npm run download && node-gyp rebuild -v && npm run bundle`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @openzim/[email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2024-05-18T17_00_37_694Z-debug.log

This seems to be a known issue as there is mention of it here: https://github.com/openzim/mwoffliner/issues/1889 https://github.com/openzim/mwoffliner/issues/1880

I am using python 3.10. Node version is v18.20.2 Anything that I can do? Thank you!

Mewto7 avatar May 18 '24 17:05 Mewto7

I hardly believe that npm triggers a pip3 command!!!

kelson42 avatar May 18 '24 18:05 kelson42

I don't think using npm with sudo is recommended, in general

audiodude avatar May 18 '24 19:05 audiodude

I hardly believe that npm triggers a pip3 command!!!

My bad. When I couldn't get it to install, I tried to install libzim using pip. When I copied the text to paste here, I copied that too since one of the issues said that might be a problem if I already have it. I edited it out. Do you mind taking another look? Thanks.

Mewto7 avatar May 19 '24 01:05 Mewto7

I don't think using npm with sudo is recommended, in general

You might need to run this command with the sudo command, depending how your npm is configured.

I did that because it said that on the read me. I am going to try without it and see if that works.

Thanks!

Mewto7 avatar May 19 '24 01:05 Mewto7

Having this same issue. Using the latest MacOS, latest NPM and latest Python. Tried on both sudo/non-sudo, no dice.

WAUthethird avatar May 19 '24 01:05 WAUthethird

Having this same issue. Using the latest MacOS, latest NPM and latest Python. Tried on both sudo/non-sudo, no dice.

In one of the issues here, they recommend downgrading the python version. Have you tried that?

I just removed Lubuntu and now I am going with a fresh install of Ubuntu. I will update the progress.

Mewto7 avatar May 19 '24 07:05 Mewto7

No external dependency should be installed manually. Non x86 macOS are not supported.

kelson42 avatar May 19 '24 09:05 kelson42

No external dependency should be installed manually. Non x86 macOS are not supported.

I tried with Ubuntu 20.04.4 and the result is the same. I am now trying with Docker. It appears to have installed fine in docker but when I try to run it, I get this:

kurisu@kurisu:~$ sudo docker run -it ghcr.io/openzim/mwoffliner:dev

starting redis-server in the background…

/usr/local/sbin/mwoffliner: line 2:    14 Illegal instruction     (core dumped) /usr/local/bin/mwoffliner --redis=$REDIS "$@"

I am assuming that is because I am not inputting the correct command.

Running with npm gives this:

kurisu@kurisu:~$ npm i -g mwoffliner
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
npm WARN deprecated [email protected]: Use your platform's native DOMException instead
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated [email protected]: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: unmaintained
npm ERR! code 7
npm ERR! path /home/kurisu/.nvm/versions/node/v20.13.1/lib/node_modules/mwoffliner/node_modules/@openzim/libzim
npm ERR! command failed
npm ERR! command sh -c npm run download && node-gyp rebuild -v && npm run bundle
npm ERR! > @openzim/[email protected] download
npm ERR! > node ./download-libzim.js
npm ERR! 
npm ERR! Downloading Libzim from:  http://download.openzim.org/release/libzim/libzim_linux-x86_64-6.3.2.tar.gz
npm ERR! Running Extract: [tar --strip-components 1 -xf ./download/libzim_linux-x86_64-6.3.2.tar.gz -C ./download]
npm ERR! Successfully downloaded and extracted file
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   '/home/kurisu/.nvm/versions/node/v20.13.1/bin/node',
npm ERR! gyp verb cli   '/home/kurisu/.nvm/versions/node/v20.13.1/lib/node_modules/mwoffliner/node_modules/.bin/node-gyp',
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '-v'
npm ERR! gyp verb cli ]
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb find Python Python is not set from command line or npm configuration
npm ERR! gyp verb find Python Python is not set from environment variable PYTHON
npm ERR! gyp verb find Python checking if "python3" can be used
npm ERR! gyp verb find Python - executing "python3" to get executable path
npm ERR! gyp verb find Python - executable path is "/usr/bin/python3"
npm ERR! gyp verb find Python - executing "/usr/bin/python3" to get version
npm ERR! gyp verb find Python - version is "3.10.12"
npm ERR! gyp info find Python using Python version 3.10.12 found at "/usr/bin/python3"
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 20.13.1
npm ERR! gyp verb command install [ '20.13.1' ]
npm ERR! gyp verb install input version string "20.13.1"
npm ERR! gyp verb install installing version: 20.13.1
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 20.13.1
npm ERR! gyp verb build dir attempting to create "build" dir: /home/kurisu/.nvm/versions/node/v20.13.1/lib/node_modules/mwoffliner/node_modules/@openzim/libzim/build
npm ERR! gyp verb build dir "build" dir needed to be created? /home/kurisu/.nvm/versions/node/v20.13.1/lib/node_modules/mwoffliner/node_modules/@openzim/libzim/build
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp ERR! UNCAUGHT EXCEPTION 
npm ERR! gyp ERR! stack TypeError: Cannot assign to read only property 'cflags' of object '#<Object>'
npm ERR! gyp ERR! stack     at createConfigFile (/home/kurisu/.nvm/versions/node/v20.13.1/lib/node_modules/mwoffliner/node_modules/node-gyp/lib/configure.js:118:21)
npm ERR! gyp ERR! stack     at /home/kurisu/.nvm/versions/node/v20.13.1/lib/node_modules/mwoffliner/node_modules/node-gyp/lib/configure.js:85:9
npm ERR! gyp ERR! stack     at /home/kurisu/.nvm/versions/node/v20.13.1/lib/node_modules/mwoffliner/node_modules/node-gyp/node_modules/mkdirp/index.js:30:20
npm ERR! gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:187:23)
npm ERR! gyp ERR! System Linux 6.5.0-18-generic
npm ERR! gyp ERR! command "/home/kurisu/.nvm/versions/node/v20.13.1/bin/node" "/home/kurisu/.nvm/versions/node/v20.13.1/lib/node_modules/mwoffliner/node_modules/.bin/node-gyp" "rebuild" "-v"
npm ERR! gyp ERR! cwd /home/kurisu/.nvm/versions/node/v20.13.1/lib/node_modules/mwoffliner/node_modules/@openzim/libzim
npm ERR! gyp ERR! node -v v20.13.1
npm ERR! gyp ERR! node-gyp -v v6.1.0
npm ERR! gyp ERR! This is a bug in `node-gyp`.
npm ERR! gyp ERR! Try to update node-gyp and file an Issue if it does not help:
npm ERR! gyp ERR!     <https://github.com/nodejs/node-gyp/issues>

npm ERR! A complete log of this run can be found in: /home/kurisu/.npm/_logs/2024-05-19T10_34_45_156Z-debug-0.log

Mewto7 avatar May 19 '24 10:05 Mewto7

Your are using nodejs20 and it has to be nodejs18

kelson42 avatar May 19 '24 11:05 kelson42

Your are using nodejs20 and it has to be nodejs18

So I fixed that issue. Unfortunately, it seems my processor just does not support it. I can install it and the docker but it just won't start and says

kurisu@kurisu:~$ mwoffliner --help
Illegal instruction (core dumped)

https://github.com/nodejs/node/issues/48700

I will try on another PC.

Thanks for everything.

Mewto7 avatar May 19 '24 15:05 Mewto7

@Mewto7 Thank you for the update and your patience. I have created an issue at openzim/node-libzim level to implement native support of the macOS ARM based CPUs. This is essential and will be implemented soon. See https://github.com/openzim/node-libzim/issues/133

kelson42 avatar Jun 24 '24 08:06 kelson42