I am unable to run the generator with v15.8.0 (with npm 7.5.1).
It works fine with v14.15.0.
> [email protected] build
> ./node_modules/.bin/ag ifc-pre-processor/asyncapi.yaml @asyncapi/html-template -o dist
Something went wrong:
TypeError: must call as: npm.load(callback)
at Object.load (/usr/local/lib/node_modules/npm/lib/npm.js:129:13)
at npmi (/Users/adameri/Developer/bimspot/async-api-docs/node_modules/npmi/npmi.js:189:9)
at /Users/adameri/Developer/bimspot/async-api-docs/node_modules/@asyncapi/generator/lib/generator.js:377:7
npm ERR! code 1
npm ERR! path /Users/adameri/Developer/bimspot/async-api-docs
npm ERR! command failed
npm ERR! command sh -c ./node_modules/.bin/ag ifc-pre-processor/asyncapi.yaml @asyncapi/html-template -o dist
Install node 15, delete existing output folder, run generator.
Docs are generated in the output folder
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
@eriadam at the moment we recommend downgrading npm to 6.13.7 because of the issue you mentioned. I will move this issue to the generator repository as the fix needs to be provided there. Can you please update the title that the issue is not really with the node version but npm (node 15 by default gets npm 7)?
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
I downgraded npm to 6.13.7 and first time that I ran "ag https://bit.ly/asyncapi @asyncapi/html-template -o example" all was fine and I got html generated. Second time I tried to run the command on some AsyncAPI yaml of my own I got an error and now when I try to rerun "ag https://bit.ly/asyncapi @asyncapi/html-template -o example" I get the same error:
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'commander'
Require stack:
@mchristensen43 just to make sure what is the source of the bug, can you install commander (npm i commander) and see if thats help, or you get more errors after that?
Tried installing commander. Then got other module missing errors (minimatch, @asyncapi/parser, node-fetch, ajv) and am now getting:
/usr/local/lib/node_modules/@asyncapi/generator/lib/templateConfigValidator.js:6
const ajv = new Ajv({ allErrors: true });
^
TypeError: Ajv is not a constructor
at Object.
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
@mchristensen43 I'm afraid you will have to downgrade to node 14 until we find a solution 馃槥
@mchristensen43 I have node 15.7.0 with npm 6.14.11 and all working for me. i generated typescript types multiple times + doc website.
also it worked with node 15.8.0 and npm 16.13.7
well this is confusing 馃槙 @stavalfi did you use the CLI like @mchristensen43 or generator as a library?
yarn ag --force-write src/topics.async-api-compiled.json @lagoni/asyncapi-quicktype-template -o ../types/src/topics-types --param \"quicktypeLanguage=typescript\"
yarn ag --force-write src/config/topics.async-api-compiled.json @asyncapi/html-template -o dist/async-api-doc-website
In ran into the same issue.
node --version: v14.15.1
I downgraded npm to 6.13.7 to work around the initial issue. Since I'm using Windows with nvm to manage the NodeJS versions I ran into another issue where npmi -> global-npm complains about MODULE_NOT_FOUND (npm).
Now I'm running the generator like
yarn cross-env GLOBAL_NPM_PATH=C:\Users\*\AppData\Local\Yarn\Data\global\node_modules\npm ag ..
Temporarily gave up on making it work on my Mac and am now running it through Docker. Something like:
docker run --rm -it -v $PWD:/app/ asyncapi/generator -o /app/output /app/my_asyncapi_file.yaml @asyncapi/html-template --force-write
Works like a charm.
@mchristensen43 I have node 15.7.0 with npm 6.14.11 and all working for me. i generated typescript types multiple times + doc website.
also it worked with node 15.8.0 and npm 16.13.7
try from scratch: remove the output as well as your node modules
In ran into the same issue.
node --version: v14.15.1
I downgraded npm to 6.13.7 to work around the initial issue. Since I'm using Windows with nvm to manage the NodeJS versions I ran into another issue where npmi -> global-npm complains aboutMODULE_NOT_FOUND(npm).
Now I'm running the generator like
yarn cross-env GLOBAL_NPM_PATH=C:\Users\*\AppData\Local\Yarn\Data\global\node_modules\npm ag ..
I've encountered the same issue as you, fixing it like that:
downgrading my environment using:
npm install -g [email protected]
nvm install v12.20.2
nvm use v12.20.2
rm -rf node_modules package-lock.json async-html
npm i
npm i -g cross-env
ag -o async-html --force-write ./docs/asyncapi.yml @asyncapi/html-template ; serve -s async-html (note the use of serve here to run a simple http server on localhost)
works like a charm again !
I'v ended installing globally cross-env on my laptop, using npm i -g cross-env.
any issues you might spot for now with cross-env when using HTML template or chokadir when running ag command should be fixed with the latest generator and html-template
@Ostefanini @eriadam @briggySmalls @mchristensen43 @alex-mueller @stavalfi thanks a lot to all of you for your input on this issue. I started working on a fix, if you have something to add, please please do
@Ostefanini @eriadam @briggySmalls @mchristensen43 @alex-mueller @stavalfi PR is ready for review. Have a look if you want. This PR adds support for latest node and npm + adds integration tests and debug information that will help us more in the future to fix and troubleshoot those issues
:tada: This issue has been resolved in version 1.2.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Release 1.2 enables support for latest node and npm and fixes all known installation issues. In case you see some other issues, please create a new issue. Please use --debug flag when you experience issues with the generator and in the issues mention the troubleshooting logs. Thanks!
Most helpful comment
Release 1.2 enables support for latest node and npm and fixes all known installation issues. In case you see some other issues, please create a new issue. Please use
--debugflag when you experience issues with the generator and in the issues mention the troubleshooting logs. Thanks!