zowe / zowe-cli

Zowe CLI
Eclipse Public License 2.0
108 stars 85 forks source link

Offline installation with zowe-cli.tgz package in error --> npm ERR! cb() never called! / http fetch GET 407 https://regisfetry.npmjs.org/cpu-features #2099

Closed FALLAI-Denis closed 3 months ago

FALLAI-Denis commented 3 months ago

Describe the bug

We don't have the possibility to install Zowe CLI using npm and downloading from the npmjs registry on the internet, (enterprise proxy blocking Internet access outside of web navigator). We therefore carry out installations from the zowe-cli.tgz packages previously downloaded from the zowe.org internet site.

Expected and actual results

Details about the behavior:

  1. Command issued:

npm install -g zowe-cli.tgz

  1. Expected results:

Installation successfull...

  1. Actual results:

The installation fails with the following messages:

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     https://npm.community/

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\<user>\AppData\Roaming\npm-cache\_logs\<date>debug.log
  1. Applicable log files:

Apparently, although the installation is intended to be offline, there is an attempt to download the component cpu-features (line 292) from the npmjs registry, which triggers in our context an http 407 status:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   'zowe-cli.tgz'
1 verbose cli ]
2 info using npm@6.14.15
3 info using node@v14.18.0
4 verbose npm-session 89149adb880ec575
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly pacote file manifest for undefined@file:zowe-cli.tgz fetched in 2081ms
8 timing stage:loadCurrentTree Completed in 3426ms
9 silly install loadIdealTree
10 silly install cloneCurrentTreeToIdealTree
11 timing stage:loadIdealTree:cloneCurrentTree Completed in 16ms
12 silly install loadShrinkwrap
13 timing stage:loadIdealTree:loadShrinkwrap Completed in 260ms
14 silly install loadAllDepsIntoIdealTree
15 silly resolveWithNewModule @zowe/cli@7.23.3 checking installable status
16 silly tarball trying file:C:/Trv/DownLoad/zOS/ZOWE/zowe-cli-package-2.15.0/zowe-cli.tgz by hash: sha512-ozFP+z1SEUFAZtPORh1ApoWPAEBvKqRKiFN844wv/NoIDo62G29R+irHwXs9hKgs/Hj0BJ1nmPzSZL/nxvtR3w==
17 silly extract file:C:/Trv/DownLoad/zOS/ZOWE/zowe-cli-package-2.15.0/zowe-cli.tgz extracted to C:\Users\xxxxxxx\AppData\Local\Temp\npm-45968-e77404a9\unpack-40291d94 (49817ms)
18 silly addBundled read tarball
19 silly cleanup remove extracted module
20 silly removeObsoleteDep removing @zowe/cli@7.23.0 from the tree as its been replaced by a newer version or is no longer required
21 silly removeObsoleteDep removing @zowe/core-for-zowe-sdk@7.23.0 from the tree as its been replaced by a newer version or is no longer required
[...]
290 silly removeObsoleteDep removing mkdirp@1.0.4 from the tree as its been replaced by a newer version or is no longer required
291 silly removeObsoleteDep removing yallist@4.0.0 from the tree as its been replaced by a newer version or is no longer required
292 http fetch GET 407 https://registry.npmjs.org/cpu-features 190ms
293 timing npm Completed in 63484ms
294 error cb() never called!
295 error This is an error with npm itself. Please report this error at:
296 error <https://npm.community>

Describe your environment

Additional context

Direct installation of the cpu-features-0.0.1.tgz package triggers another error this time on the plugin nan: http fetch GET 407 https://registry.npmjs.org/nan

github-actions[bot] commented 3 months ago

Thank you for creating a bug report. We will investigate the bug and evaluate its impact on the product. If you haven't already, please ensure you have provided steps to reproduce the bug and as much context as possible.

t1m0thyj commented 3 months ago

@FALLAI-Denis Based on the logs your environment is using Node.js 14 and npm@6. Zowe CLI only supports active LTS (Long Term Support) releases of Node, which currently are Node.js 18 and 20.

We believe the offline install error should be fixed in newer versions of npm which is distributed with Node. Please update your installation of Node.js to an actively supported version.

FALLAI-Denis commented 3 months ago

Hi @t1m0thyj,

A priori this is not a node.js / npm version problem, but rather an Internet access problem. And moreover we do not have the possibility of changing the version of node.js / npm on our workstations.

By using a proxy server, (Artifactory), to access the npmjs registry, the installation could be carried out both in download mode, (npm install -g @zowe/cli@zowe-v2-lts), and from the latest archive file (npm install -g zowe-cli.tgz).

The problem is that the zowe-cli.tgz archive file still downloads from the Internet, for the plugin cpu-features, which itself downloads for the nan plugin.

This problem should be fixed to allow 100% offline installation.


Furthermore, in the case of installation by npm install -g @zowe/cli@zowe-v2-lts, which is version 7.23.8, it is then impossible to install a plugin: this triggers an error:

>zowe plugins install @zowe/zos-ftp-for-zowe-cli
Handler Instantiation Failed:
Could not instantiate the handler C:\ProgramData\nvm\v14.18.0\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\imperative\src\plugins\cmd\install\install.handler for command install
Error Details:
Unexpected token '??='

This problem does not appear with the npm install -g zowe-cli.tgz installation, which is in version 7.23.3.

adam-wolfe commented 3 months ago

With Node 16, 18, and 20, Zowe CLI can be installed offline from the zowe-cli.tgz available at zowe.org and plug-in installation works without any issues. However, with Node 14, the offline installation fails and plug-ins cannot be installed.

Zowe CLI supports LTS versions of Node that are actively maintained (currently Node 18 and 20). https://docs.zowe.org/stable/user-guide/systemrequirements-cli

Because these issues only occur in an unsupported version of Node.js, no fix is planned.