SAP / generator-easy-ui5

Meta-generator various project types within the UI5 Universe
https://blogs.sap.com/2021/04/09/easy-ui5-3.0-from-community-contributions-to-community-plugins/
Apache License 2.0
242 stars 72 forks source link

generator-easy-ui5 installation failed #81

Closed softshipper closed 2 years ago

softshipper commented 2 years ago

Hi all,

Trying to install npm install -g generator-easy-ui5 the following error messages occur:

error path C:\node-v16.13.0-win-x64\node_modules\generator-easy-ui5
error command failed
error command C:\WINDOWS\system32\cmd.exe /d /s /c node generators/app/postinstall
error C:\node-v16.13.0-win-x64\node_modules\generator-easy-ui5\node_modules\@octokit\request\dist-node\index.js:108
error     throw new requestError.RequestError(error.message, 500, {
error           ^
error
error RequestError [HttpError]: request to https://api.github.com/repos/ui5-community/generator-ui5-project/branches/main failed, reason: connect ECONNREFUSED 140.82.121.5:443
error     at C:\node-v16.13.0-win-x64\node_modules\generator-easy-ui5\node_modules\@octokit\request\dist-node\index.js:108:11
error     at processTicksAndRejections (node:internal/process/task_queues:96:5)
error     at async C:\node-v16.13.0-win-x64\node_modules\generator-easy-ui5\generators\app\postinstall.js:44:21 {
error   status: 500,
error   request: {
error     method: 'GET',
error     url: 'https://api.github.com/repos/ui5-community/generator-ui5-project/branches/main',
error     headers: {
error       accept: 'application/vnd.github.v3+json',
error       'user-agent': 'generator-easy-ui5 octokit-rest.js/18.12.0 octokit-core.js/3.5.1 Node.js/16.13.0 (win32; x64)'
error     },
error     request: { hook: [Function: bound bound register] }
error   }
error }
verbose exit 1

I also tried to install another generator, for instance npm install -g generator-jhipster and no error messages occur:

npm install -g generator-jhipster
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: 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 request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated uuid@3.3.2: 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.

added 573 packages, and audited 574 packages in 35s

59 packages are looking for funding
  run `npm fund` for details

9 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

What am I doing wrong?

Thanks

softshipper commented 2 years ago

the statement yo doctor looks also fine:

Yeoman Doctor
Running sanity checks on your system

√ No .bowerrc file in home directory
√ Global configuration file is valid
√ NODE_PATH matches the npm root
√ No .yo-rc.json file in home directory
√ Node.js version
√ npm version
√ yo version

Everything looks all right!
IObert commented 2 years ago

It seems like you hit the GitHub API limit with this request. Please try to access this page which should give you a similar error message: https://api.github.com/users/octocat

It's funny, I just added a better handling of this error and pushed it 0d23479. I'll publish this version probably tomorrow and then you should see an error message like this one:

Screenshot 2021-11-24 at 17 17 38
softshipper commented 2 years ago

Sorry I do not get it. What exactly do I have to do? I tried it again and still it does not work.

IObert commented 2 years ago

Please update easyui5 to version 3.1.3 and then try again. If you still run into a problem, please paste another screenshot here.

softshipper commented 2 years ago

Again the same error message:

npm install -g generator-easy-ui5@3.1.3
npm ERR! code 1
npm ERR! path C:\node-v16.13.0-win-x64\node_modules\generator-easy-ui5
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node generators/app/postinstall
npm ERR! C:\node-v16.13.0-win-x64\node_modules\generator-easy-ui5\node_modules\@octokit\request\dist-node\index.js:108
npm ERR!     throw new requestError.RequestError(error.message, 500, {
npm ERR!           ^
npm ERR! 
npm ERR! RequestError [HttpError]: request to https://api.github.com/repos/ui5-community/generator-ui5-project/branches/main failed, reason: connect ECONNREFUSED 140.82.121.6:443
npm ERR!     at C:\node-v16.13.0-win-x64\node_modules\generator-easy-ui5\node_modules\@octokit\request\dist-node\index.js:108:11
npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm ERR!     at async C:\node-v16.13.0-win-x64\node_modules\generator-easy-ui5\generators\app\postinstall.js:44:21 {
npm ERR!   status: 500,
npm ERR!   request: {
npm ERR!     method: 'GET',
npm ERR!     url: 'https://api.github.com/repos/ui5-community/generator-ui5-project/branches/main',
npm ERR!     headers: {
npm ERR!       accept: 'application/vnd.github.v3+json',
npm ERR!       'user-agent': 'generator-easy-ui5 octokit-rest.js/18.12.0 octokit-core.js/3.5.1 Node.js/16.13.0 (win32; x64)'
npm ERR!     },
npm ERR!     request: { hook: [Function: bound bound register] }
npm ERR!   }
npm ERR! }

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\amar\AppData\Local\npm-cache\_logs\2021-11-25T09_30_32_360Z-debug.log
softshipper commented 2 years ago
 yo easy-ui5
Error easy-ui5 

You don't seem to have a generator with the name “easy-ui5” installed.
But help is on the way:

You can see available generators via npm search yeoman-generator or via http://yeoman.io/generators/.
Install them with npm install generator-easy-ui5.

To see all your installed generators run yo --generators. Adding the --help option will also show subgenerators.

If yo cannot find the generator, run yo doctor to troubleshoot your system.
softshipper commented 2 years ago

what am I doing wrong?

IObert commented 2 years ago

I am not sure. I just asked a colleague who also uses Windows to test it. It works for him :-/

Is it possible that you are running this from a VPN or corporate network? If so, can you try it from another network?

softshipper commented 2 years ago

when I try to install other stuff for example:

npm install -g generator-hubot
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: 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 request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated simple-bufferstream@0.0.4: no longer maintained
npm WARN deprecated CSSwhat@0.4.7: the module is now available as 'css-what'
npm WARN deprecated uuid@2.0.3: 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 minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated tar@1.0.3: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated CSSselect@0.4.1: the module is now available as 'css-select'

added 306 packages, and audited 307 packages in 24s

5 packages are looking for funding
  run `npm fund` for details

28 vulnerabilities (1 low, 8 moderate, 9 high, 10 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

It works as expected.

IObert commented 2 years ago

Yes, these generators don't call the GitHub API once they were downloaded (easy-ui5 does this). And somehow GitHub blocks request from your machine/network.

RequestError [HttpError]: request to https://api.github.com/repos/ui5-community/generator-ui5-project/branches/main failed, reason: connect ECONNREFUSED 140.82.121.6:443

softshipper commented 2 years ago

Could you provide the possibility to inject a HttpProxyAgent in https://github.com/SAP/generator-easy-ui5/blob/main/generators/app/postinstall.js#L44.

I have created example and it is written in TS:

import { Octokit } from "@octokit/rest";
import { HttpProxyAgent } from "http-proxy-agent";

const ghOrg = "ui5-community",
    repoName = "generator-ui5-project",
    branch = "main";

const proxy =  process.env.http_proxy;
const agent: HttpProxyAgent | unknown = proxy !== undefined ? new HttpProxyAgent(proxy) : null;

const octokit = new Octokit({
    userAgent: "generator-easy-ui5",
    request: {
        agent: agent
    }
});

octokit.repos.getBranch({
    owner: ghOrg,
    repo: repoName,
    branch,
}).then(console.log)
    .catch(e => {
        console.error("#################### ERROR ####################");
        console.log(e);
    });

Thanks

IObert commented 2 years ago

It seems like you already have done some experiments with this. Do you want to test it locally and open a PR with this change? I think this might be easier then.

Also, can you add a similar feature in the main generator file and change the http-proxy from being an environment variable to an option similar to ghAuthToken: https://github.com/SAP/generator-easy-ui5/blob/main/generators/app/index.js#L132

softshipper commented 2 years ago

I have still problem with the proxy. Need to figure out first.

softshipper commented 2 years ago

I have commented the issue here https://github.com/SAP/generator-easy-ui5/issues/79

petermuessig commented 2 years ago

Let's continue on #79 - hence, I will close this issue here.