mwoffliner icon indicating copy to clipboard operation
mwoffliner copied to clipboard

Problem installing mwoffliner

Open phpll-cyber opened this issue 2 years ago • 13 comments
trafficstars

Hello I am trying to install mwoffliner I wanted the following command as administrator npm i -g mwoffliner And I encountered the following error 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]: this library is no longer supported npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated 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 1 npm ERR! path /usr/local/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 '/usr/bin/node', npm ERR! gyp verb cli '/usr/local/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.11.4" npm ERR! gyp info find Python using Python version 3.11.4 found at "/usr/bin/python3" npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 18.13.0 npm ERR! gyp verb command install [ '18.13.0' ] npm ERR! gyp verb install input version string "18.13.0" npm ERR! gyp verb install installing version: 18.13.0 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: 18.13.0 npm ERR! gyp verb build dir attempting to create "build" dir: /usr/local/lib/node_modules/mwoffliner/node_modules/@openzim/libzim/build npm ERR! gyp verb build dir "build" dir needed to be created? /usr/local/lib/node_modules/mwoffliner/node_modules/@openzim/libzim/build npm ERR! gyp verb build/config.gypi creating config file npm ERR! gyp verb build/config.gypi writing out config file: /usr/local/lib/node_modules/mwoffliner/node_modules/@openzim/libzim/build/config.gypi npm ERR! (node:655759) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only. npm ERR! (Use node --trace-deprecation ... to show where the warning was created) npm ERR! gyp verb config.gypi checking for gypi file: /usr/local/lib/node_modules/mwoffliner/node_modules/@openzim/libzim/config.gypi npm ERR! gyp verb common.gypi checking for gypi file: /usr/local/lib/node_modules/mwoffliner/node_modules/@openzim/libzim/common.gypi npm ERR! gyp verb gyp gyp format was not specified; forcing "make" npm ERR! gyp info spawn /usr/bin/python3 npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args '/usr/local/lib/node_modules/mwoffliner/node_modules/node-gyp/gyp/gyp_main.py', npm ERR! gyp info spawn args 'binding.gyp', npm ERR! gyp info spawn args '-f', npm ERR! gyp info spawn args 'make', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/usr/local/lib/node_modules/mwoffliner/node_modules/@openzim/libzim/build/config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/usr/local/lib/node_modules/mwoffliner/node_modules/node-gyp/addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/root/.cache/node-gyp/18.13.0/include/node/common.gypi', npm ERR! gyp info spawn args '-Dlibrary=shared_library', npm ERR! gyp info spawn args '-Dvisibility=default', npm ERR! gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/18.13.0', npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/mwoffliner/node_modules/node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/18.13.0/<(target_arch)/node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=/usr/local/lib/node_modules/mwoffliner/node_modules/@openzim/libzim', npm ERR! gyp info spawn args '-Dnode_engine=v8', npm ERR! gyp info spawn args '--depth=.', npm ERR! gyp info spawn args '--no-parallel', npm ERR! gyp info spawn args '--generator-output', npm ERR! gyp info spawn args 'build', npm ERR! gyp info spawn args '-Goutput_dir=.' npm ERR! gyp info spawn args ] npm ERR! Traceback (most recent call last): npm ERR! File "/usr/local/lib/node_modules/mwoffliner/node_modules/node-gyp/gyp/gyp_main.py", line 50, in npm ERR! sys.exit(gyp.script_main()) npm ERR! ^^^^^^^^^^^^^^^^^ npm ERR! File "/usr/local/lib/node_modules/mwoffliner/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 554, in script_main npm ERR! return main(sys.argv[1:]) npm ERR! ^^^^^^^^^^^^^^^^^^ npm ERR! File "/usr/local/lib/node_modules/mwoffliner/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 547, in main npm ERR! return gyp_main(args) npm ERR! ^^^^^^^^^^^^^^ npm ERR! File "/usr/local/lib/node_modules/mwoffliner/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 520, in gyp_main npm ERR! [generator, flat_list, targets, data] = Load( npm ERR! ^^^^^ npm ERR! File "/usr/local/lib/node_modules/mwoffliner/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 136, in Load npm ERR! result = gyp.input.Load(build_files, default_variables, includes[:], npm ERR! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ npm ERR! File "/usr/local/lib/node_modules/mwoffliner/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2782, in Load npm ERR! LoadTargetBuildFile(build_file, data, aux_data, npm ERR! File "/usr/local/lib/node_modules/mwoffliner/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 391, in LoadTargetBuildFile npm ERR! build_file_data = LoadOneBuildFile(build_file_path, data, aux_data, npm ERR! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ npm ERR! File "/usr/local/lib/node_modules/mwoffliner/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 234, in LoadOneBuildFile npm ERR! build_file_contents = open(build_file_path, 'rU').read() npm ERR! ^^^^^^^^^^^^^^^^^^^^^^^^^^^ npm ERR! ValueError: invalid mode: 'rU' while trying to load binding.gyp npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: gyp failed with exit code: 1 npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/mwoffliner/node_modules/node-gyp/lib/configure.js:351:16) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28) npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12) npm ERR! gyp ERR! System Linux 6.2.0-20-generic npm ERR! gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/mwoffliner/node_modules/.bin/node-gyp" "rebuild" "-v" npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/mwoffliner/node_modules/@openzim/libzim npm ERR! gyp ERR! node -v v18.13.0 npm ERR! gyp ERR! node-gyp -v v6.1.0 npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2023-08-23T19_44_07_622Z-debug-0.log What could be the problem and how can it be solved? Thank you

phpll-cyber avatar Aug 23 '23 21:08 phpll-cyber

On which system/architecture is that?

kelson42 avatar Aug 24 '23 00:08 kelson42

On which system/architecture is that?

Ubuntu 23.04

phpll-cyber avatar Aug 28 '23 19:08 phpll-cyber

Does it matter? If necessary, I can replace system/architecture

phpll-cyber avatar Aug 28 '23 19:08 phpll-cyber

@phpll-cyber yes, at it seems to die around the libzim binding. Right now I don't know exactly what to tell you. @VadimKovalenkoSNF Maybe you have quickly and advice.

@phpll-cyber As a workaround I woukd recomment to try the MWoffliner Docker image.

kelson42 avatar Aug 29 '23 02:08 kelson42

Looks like the problem indeed with libzim binding. I faced something similar on MacOS. On Ubuntu 20.04.6 LTS works as expected.

VadimKovalenkoSNF avatar Aug 29 '23 05:08 VadimKovalenkoSNF

@phpll-cyber Might that be you have the libzim already installed on your system?

kelson42 avatar Aug 29 '23 05:08 kelson42

@phpll-cyber yes, at it seems to die around the libzim binding. Right now I don't know exactly what to tell you. @VadimKovalenkoSNF Maybe you have quickly and advice.

@phpll-cyber As a workaround I woukd recomment to try the MWoffliner Docker image.

I thought about it at first However I was unable to install the mwoffliner docker image Because the mwoffliner docker image has been removed from the official docker website The question is what else can be done?

phpll-cyber avatar Aug 29 '23 15:08 phpll-cyber

@phpll-cyber Might that be you have the libzim already installed on your system?

I don't remember installing it But what should it bother?

phpll-cyber avatar Aug 29 '23 15:08 phpll-cyber

Looks like the problem indeed with libzim binding. I faced something similar on MacOS. On Ubuntu 20.04.6 LTS works as expected. If I change system/architecture can it help? And if so, which system/architecture is the most recommended to switch to?

phpll-cyber avatar Aug 29 '23 15:08 phpll-cyber

@phpll-cyber Just try to understand for the moment. You might be impacted by https://github.com/nodejs/node-gyp/issues/2219. Our side, we will update gyp in version 2.0.0.

kelson42 avatar Aug 30 '23 00:08 kelson42

@phpll-cyber Just try to understand for the moment. You might be impacted by nodejs/node-gyp#2219. Our side, we will update gyp in version 2.0.0.

No

phpll-cyber avatar Aug 30 '23 15:08 phpll-cyber

I get this on Arch on WSL2 :

npm ERR! gyp http 404 https://nodejs.org/download/release/v18.17.1/win-arm64/node.lib
npm ERR! gyp verb arm64 node.lib was not found in https://nodejs.org/download/release/v18.17.1/win-arm64/node.lib
npm ERR! gyp verb content checksum win-x86/node.lib 7982f49aac6ff5b4cfaa236793f62a8c18b0bc9f1f2903617b9fdafee377bb2b
npm ERR! gyp verb content checksum win-x64/node.lib fce36923d974ac8f9cea4bd68e56ab055797fd5b5ede5041b228d642a0d9bb40
npm ERR! gyp verb download contents checksum {"node-v18.17.1-headers.tar.gz":"04ee43f5b27200379cf531f954d4de289b4870c36161c48d427fa741be3e67fb","win-x86/node.lib":"7982f49aac6ff5b4cfaa236793f62a8c18b0bc9f1f2903617b9fdafee377bb2b","win-x64/node.lib":"fce36923d974ac8f9cea4bd68e56ab055797fd5b5ede5041b228d642a0d9bb40"}
npm ERR! gyp verb validating download checksum for node-v18.17.1-headers.tar.gz (04ee43f5b27200379cf531f954d4de289b4870c36161c48d427fa741be3e67fb == 04ee43f5b27200379cf531f954d4de289b4870c36161c48d427fa741be3e67fb)
npm ERR! gyp verb validating download checksum for win-x86/node.lib (7982f49aac6ff5b4cfaa236793f62a8c18b0bc9f1f2903617b9fdafee377bb2b == 7982f49aac6ff5b4cfaa236793f62a8c18b0bc9f1f2903617b9fdafee377bb2b)
npm ERR! gyp verb validating download checksum for win-x64/node.lib (fce36923d974ac8f9cea4bd68e56ab055797fd5b5ede5041b228d642a0d9bb40 == fce36923d974ac8f9cea4bd68e56ab055797fd5b5ede5041b228d642a0d9bb40)
npm ERR! gyp verb get node dir target node version installed: 18.17.1
npm ERR! gyp verb build dir attempting to create "build" dir: C:\Users\ngermann01\AppData\Roaming\npm\node_modules\mwoffliner\node_modules\@openzim\libzim\build
npm ERR! gyp verb build dir "build" dir needed to be created? C:\Users\ngermann01\AppData\Roaming\npm\node_modules\mwoffliner\node_modules\@openzim\libzim\build
npm ERR! gyp verb find VS msvs_version not set from command line or npm config
npm ERR! gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp verb find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp verb find VS checking VS2019 (16.11.33920.266) found at:
npm ERR! gyp verb find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
npm ERR! gyp verb find VS - found "Visual Studio C++ core features"
npm ERR! gyp verb find VS - missing any VC++ toolset
npm ERR! gyp verb find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp verb find VS looking for Visual Studio 2015
npm ERR! gyp verb find VS - not found
npm ERR! gyp verb find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp ERR! find VS checking VS2019 (16.11.33920.266) found at:
npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - missing any VC++ toolset
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack     at VisualStudioFinder.fail (C:\Users\ngermann01\AppData\Roaming\npm\node_modules\mwoffliner\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
npm ERR! gyp ERR! stack     at C:\Users\ngermann01\AppData\Roaming\npm\node_modules\mwoffliner\node_modules\node-gyp\lib\find-visualstudio.js:74:16
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\ngermann01\AppData\Roaming\npm\node_modules\mwoffliner\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
npm ERR! gyp ERR! stack     at C:\Users\ngermann01\AppData\Roaming\npm\node_modules\mwoffliner\node_modules\node-gyp\lib\find-visualstudio.js:70:14
npm ERR! gyp ERR! stack     at C:\Users\ngermann01\AppData\Roaming\npm\node_modules\mwoffliner\node_modules\node-gyp\lib\find-visualstudio.js:372:16
npm ERR! gyp ERR! stack     at C:\Users\ngermann01\AppData\Roaming\npm\node_modules\mwoffliner\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack     at C:\Users\ngermann01\AppData\Roaming\npm\node_modules\mwoffliner\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:427:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
npm ERR! gyp ERR! System Windows_NT 10.0.22621
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ngermann01\\AppData\\Roaming\\npm\\node_modules\\mwoffliner\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "-v"
npm ERR! gyp ERR! cwd C:\Users\ngermann01\AppData\Roaming\npm\node_modules\mwoffliner\node_modules\@openzim\libzim
npm ERR! gyp ERR! node -v v18.17.1
npm ERR! gyp ERR! node-gyp -v v6.1.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: C:\Users\ngermann01\AppData\Local\npm-cache\_logs\2023-09-04T09_03_58_351Z-debug-0.log

error 404 for a node.js file

Foul-Tarnished avatar Sep 04 '23 09:09 Foul-Tarnished

I had the same issue and investigated for a few hours.

The problem in the OP is that node-gyp inside openzim/node-libzim requires the 'U' flag for the open function, which has been removed in Python 3.11. (see Python docs)

As a workaround downgrade your installed Python version to 3.10 or create an Anaconda environment and install 3.10 there. Then the build should be successful.

The actual fix would be an upgrade of node-gyp in openzim/node-libzim for 2.4.4 or updating that dependency here to at least 3.0.0.

talos1111 avatar Dec 21 '23 15:12 talos1111