0

I've run into a wall with using AsyncAPI-Generator on a windows server.

I've been following these instructions and after successfully installing ag I needed to update the path the be able to access the CLI.

When running the cli I get an error saying that ag cannot find the npm module, despite being installed using npm.

C:\Users\jontia\workspace>ag cud.yml @asyncapi/java-spring-template
C:\Users\jontia\.sdkman\candidates\java\20.2.0.r11-grl\languages\js\bin\node_modules\@asyncapi\generator\node_modules\global-npm\index.js:11
  var err = new Error("Cannot find module 'npm'")
            ^

Error: Cannot find module 'npm'
    at throwNotFoundError (C:\Users\jontia\.sdkman\candidates\java\20.2.0.r11-grl\languages\js\bin\node_modules\@asyncapi\generator\node_modules\global-npm\index.js:11:13)
    at exports (C:\Users\jontia\.sdkman\candidates\java\20.2.0.r11-grl\languages\js\bin\node_modules\@asyncapi\generator\node_modules\global-npm\index.js:39:5)
    at Object.<anonymous> (C:\Users\jontia\.sdkman\candidates\java\20.2.0.r11-grl\languages\js\bin\node_modules\@asyncapi\generator\node_modules\global-npm\index.js:27:18)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.<anonymous> (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\jontia\.sdkman\candidates\java\20.2.0.r11-grl\languages\js\bin\node_modules\@asyncapi\generator\node_modules\npmi\npmi.js:1:14) {
  code: 'MODULE_NOT_FOUND'
}

This doesn't make any sense to me, how can the npm module not be available when I'm using it?

Jontia
  • 137
  • 14
  • Think we need a few more information to solve this. Depending on your npm version you you might need > [v1.2.0](https://github.com/asyncapi/generator/releases/tag/v1.2.0) of the generator, what versions are you running (npm, node, generator)? Furthermore is npm added to your path (can you use the command `npm`)? – jonaslagoni Mar 05 '21 at 23:59
  • Related to https://stackoverflow.com/questions/65716908/is-it-okay-to-install-npm-as-a-dependency – jonaslagoni May 15 '21 at 12:01

0 Answers0