Generator: Error while npm install

Created on 23 Jul 2020  路  9Comments  路  Source: asyncapi/generator

I am trying to npm install asyncapi generator. But it fails to install.

How to Reproduce

I am on Windows and I am using node v10.16.3 and npm 6.9.0

PS D:\Work Related\eventus> npm i @asyncapi/generator
npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://[email protected]/fmvilas/json-schema-ref-parser.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

Expected behavior

A clear and concise description of what you expected to happen.

bug

Most helpful comment

Ahh. I can see that even in our dockerfile it states that

Since 0.30.0 release Git is supported and required as a dependency

Guess someone forgot to update our readme 馃槃

All 9 comments

Welcome to AsyncAPI. Thanks a lot for reporting your first issue.

Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

With npm version 6.14.5 and node version v13.9.0 I am not able to reproduce this error.

Since the generator demands the following engines to run:

    "node": ">=12.16",
    "npm": ">=6.13.7"

You might have to update both npm and node regardless, and that might solve this install problem as well 馃

I overlooked the requirements. I will update the versions and check.

Updated node and npm to v12.18.3 and v6.14.7 respectively. But no luck. I have looked through the debug log. It is failing here

83 silly fetchPackageMetaData error for @apidevtools/json-schema-ref-parser@github:fmvilas/json-schema-ref-parser#add-more-info-about-errors Error while executing:

I have attached the npm debug log for reference as well.

PS D:\Work Related\eventus> npm install -g @asyncapi/generator
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://[email protected]/fmvilas/json-schema-ref-parser.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Lenovo\AppData\Roaming\npm-cache_logs\2020-07-23T10_34_56_689Z-debug.log

2020-07-23T10_34_56_689Z-debug.log

Hmm. So after looking at the dependency that can't be fetched it is "@apidevtools/json-schema-ref-parser": "github:fmvilas/json-schema-ref-parser#add-more-info-about-errors", and it seems like the github: part attempts to install it with git as stated in the npm CLI documentation:

npm install github:githubname/githubrepo[#commit-ish]:

Install the package at https://github.com/githubname/githubrepo by attempting to clone it using git.

Not sure if this translates to how it is interpreted when installing a package requiring such dependency 馃

And based on how the documentation for how package.json github dependency should be defined it doesn't match how it is defined in the parser 馃

@aravindajju do you have git installed?

Ahh. I can see that even in our dockerfile it states that

Since 0.30.0 release Git is supported and required as a dependency

Guess someone forgot to update our readme 馃槃

Thank you @jonaslagoni for this input. I have git installed, but I've realized it is not in the path for my dev setup. Once I added git to my path, I am able to install it now with no problems.

I think our priority should be to not use fork here https://github.com/asyncapi/parser-js/blob/master/package.json#L52 but rather switch to the upstream project.

if above takes to much time, we should just modify package.json to point to tarball like https://github.com/fmvilas/json-schema-ref-parser/tarball/add-more-info-about-errors so npm doesn't require git. Much better than adding git to the list of requirements. So we have no git requirement in the parser, and in the generator, we need it as some functionality needs it (the one that validates if given directory is a git repo with unstaged changes)

Now, with latest release candidate 8 we are using @apidevtools/json-schema-ref-parser from the upstream and not the fork. Issue solved

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marcortw picture marcortw  路  7Comments

derberg picture derberg  路  8Comments

arthurparahyba picture arthurparahyba  路  6Comments

bali182 picture bali182  路  11Comments

jonaslagoni picture jonaslagoni  路  5Comments