Cannon simply install @groupdocs/groupdocs.viewer via Angular CLI

I have been trying everything to install this npm package to my angular cli project @groupdocs/groupdocs.viewer. I have upgraded and downgraded NODE versions and Angular/CLI versions. I have clean npm cache, I have installed Java, JDE, Python. I don’t know what else to do.

Angular CLI: 17.3.6
Node: 20.12.2
Package Manager: npm 10.5.1

npm ERR! code 1
npm ERR! path C:\Users\vou.xiong\source\repos\vouxiong\node_modules\java
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.1
npm ERR! gyp info using node@20.12.2 | win32 | x64
npm ERR! gyp info find Python using Python version 3.12.3 found at “C:\Users\vou.xiong\AppData\Local\Programs\Python\Python312\python.exe”
npm ERR! gyp info find VS using VS2022 (17.9.34728.123) found at:
npm ERR! gyp info find VS “C:\Program Files\Microsoft Visual Studio\2022\Professional”
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Users\vou.xiong\AppData\Local\Programs\Python\Python312\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args ‘C:\Users\vou.xiong\source\repos\vouxiong\node_modules\java\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 ‘msvs’,
npm ERR! gyp info spawn args ‘-I’,
npm ERR! gyp info spawn args ‘C:\Users\vou.xiong\source\repos\vouxiong\node_modules\java\build\config.gypi’,
npm ERR! gyp info spawn args ‘-I’,
npm ERR! gyp info spawn args ‘C:\Users\vou.xiong\source\repos\vouxiong\node_modules\java\node_modules\node-gyp\addon.gypi’,
npm ERR! gyp info spawn args ‘-I’,
npm ERR! gyp info spawn args ‘C:\Users\vou.xiong\AppData\Local\node-gyp\Cache\20.12.2\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=C:\Users\vou.xiong\AppData\Local\node-gyp\Cache\20.12.2’,
npm ERR! gyp info spawn args ‘-Dnode_gyp_dir=C:\Users\vou.xiong\source\repos\vouxiong\node_modules\java\node_modules\node-gyp’,
npm ERR! gyp info spawn args ‘-Dnode_lib_file=C:\\Users\\vou.xiong\\AppData\\Local\\node-gyp\\Cache\\20.12.2\\<(target_arch)\\node.lib’,
npm ERR! gyp info spawn args ‘-Dmodule_root_dir=C:\Users\vou.xiong\source\repos\vouxiong\node_modules\java’,
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 ‘C:\Users\vou.xiong\source\repos\vouxiong\node_modules\java\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 “C:\Users\vou.xiong\source\repos\vouxiong\node_modules\java\node_modules\node-gyp\gyp\gyp_main.py”, line 42, in
npm ERR! import gyp # noqa: E402
npm ERR! ^^^^^^^^^^
npm ERR! File “C:\Users\vou.xiong\source\repos\vouxiong\node_modules\java\node_modules\node-gyp\gyp\pylib\gyp_init_.py”, line 9, in
npm ERR! import gyp.input
npm ERR! File “C:\Users\vou.xiong\source\repos\vouxiong\node_modules\java\node_modules\node-gyp\gyp\pylib\gyp\input.py”, line 19, in
npm ERR! from distutils.version import StrictVersion
npm ERR! ModuleNotFoundError: No module named ‘distutils’
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 (C:\Users\vou.xiong\source\repos\vouxiong\node_modules\java\node_modules\node-gyp\lib\configure.js:325:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:518:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm ERR! gyp ERR! System Windows_NT 10.0.22631
npm ERR! gyp ERR! command “C:\Program Files\nodejs\node.exe” “C:\Users\vou.xiong\source\repos\vouxiong\node_modules\java\node_modules\node-gyp\bin\node-gyp.js” “rebuild”
npm ERR! gyp ERR! cwd C:\Users\vou.xiong\source\repos\vouxiong\node_modules\java
npm ERR! gyp ERR! node -v v20.12.2
npm ERR! gyp ERR! node-gyp -v v9.4.1
npm ERR! gyp ERR! not ok

@vouxiong

Thank you for sharing the details. We’ll try reproducing this issue and update you.

1 Like

| vladimir.litvinchik
April 30 |

  • | - |

@vou_xiong_via_GroupDocs

Thank you for sharing the details and error message. We’ll try reproducing this issue and update you.

1 Like

| vladimir.litvinchik
April 30 |

  • | - |

I’m closing this issue. Let’s continue with this issue in Cannon simply install @groupdocs/groupdocs.viewer via Angular CLI.

1 Like

@vouxiong

We have opened the following new ticket(s) in our internal issue tracking system and will investigate it.

Issue ID(s): VIEWERNODEJS-119

We’ll let you know when we have any updates.

1 Like

Hello @vouxiong! Thank you for waiting.

The problem is occurring due to your Python version 3.12.3

You can downgrade the Python version to 3.10 or you can easily solve this issue by installing the package setuptools on your:

virtual environment

pip install setuptools

or machine

brew install python-setuptools

Explanation and workaround:

distutils package is removed in python version 3.12

Python 3.12 Release document mentions :

PEP 632: Remove the distutils package. See the migration guide for advice replacing the APIs it provided. The third-party Setuptools package continues to provide distutils, if you still require it in Python 3.12 and beyond.

1 Like

After downgrading Python, Node and Angluar CLI versions and installing setuptools it gives me a new error

C:\Users\vou.xiong\source\repos\vouxiong\node_modules\java>if not defined npm_config_node_gyp (node “C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\…..\node_modules\node-gyp\bin\node-gyp.js” rebuild ) else (node “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” rebuild )
Traceback (most recent call last):
File “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py”, line 50, in
sys.exit(gyp.script_main())
^^^^^^^^^^^^^^^^^
File “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py”, line 554, in script_main
return main(sys.argv[1:])
^^^^^^^^^^^^^^^^^^
File “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py”, line 547, in main
return gyp_main(args)
^^^^^^^^^^^^^^
File “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py”, line 520, in gyp_main
[generator, flat_list, targets, data] = Load(
^^^^^
File “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py”, line 136, in Load
result = gyp.input.Load(build_files, default_variables, includes[:],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py”, line 2782, in Load
LoadTargetBuildFile(build_file, data, aux_data,
File “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py”, line 391, in LoadTargetBuildFile
build_file_data = LoadOneBuildFile(build_file_path, data, aux_data,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py”, line 234, in LoadOneBuildFile
build_file_contents = open(build_file_path, ‘rU’).read()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid mode: ‘rU’ while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:400:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
gyp ERR! System Windows_NT 10.0.22631
gyp ERR! command “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” “rebuild”
gyp ERR! cwd C:\Users\vou.xiong\source\repos\vouxiong\node_modules\java
gyp ERR! node -v v14.21.3
gyp ERR! node-gyp -v v5.1.1
gyp ERR! not ok
npm WARN ajv-keywords@3.5.2 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.

@vouxiong

Thank you for provided details.
Let us check possible solution internally and share it with you.

We’ll let you know when we have any updates.

As I mentioned earlier, you’ll need to downgrade only Python to v3.10 OR install setuptools, in case you don’t want to change python version for some reason.

Can you please share the python version of your working environment?