mulesoft / api-console

An interactive REST console based on RAML/OAS files
Other
911 stars 237 forks source link

Install api-console-cli failed #550

Closed lanmolsz closed 6 years ago

lanmolsz commented 6 years ago

Running api-console build helloworld.raml failed, Whether it's local files or web resources.

#helloworld.raml
#%RAML 1.0
title: Hello world # required title

/greeting: # optional resource
  get: # HTTP method declaration
    responses: # declare a response
      200: # HTTP status code
        body: # declare content of response
          application/json: # media type
            # structural definition of a response (schema or type)
            type: object
            properties:
              message: string
            example: # example how a response looks like
              message: "Hello world"

I got the error message:

[root@E355 code]# api-console build helloworld.raml 
  Building the API console. This may take a moment.

Warning: You are trying to use local RAML file as an input but the --use-json optionis not set. 
Users won't be able to access the RAML file. The CLI will use --use-json to generate a JSON file for build.

error: /tmp/tmp-28444nJ16D13Buv8s/node_modules/wct-local/scripts/postinstall.js:35
    selenium.install(config, function(error) {
            ^

TypeError: Cannot read property 'install' of undefined
    at /tmp/tmp-28444nJ16D13Buv8s/node_modules/wct-local/scripts/postinstall.js:35:13
    at requireSelenium (/tmp/tmp-28444nJ16D13Buv8s/node_modules/wct-local/scripts/postinstall.js:27:3)
    at Object.<anonymous> (/tmp/tmp-28444nJ16D13Buv8s/node_modules/wct-local/scripts/postinstall.js:34:3)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:158:16)

error:  
error: Required `json` property not found.
error: Error: Required `json` property not found.
    at Object.module.exports.parse (/e355/build/npm/node_global/lib/node_modules/api-console-cli/node_modules/raml2obj/index.js:39:27)
    at JsonGenerator.enhance (/e355/build/npm/node_global/lib/node_modules/api-console-cli/node_modules/raml-json-enhance-node/lib/json-generator.js:90:24)
    at parse.then (/e355/build/npm/node_global/lib/node_modules/api-console-cli/node_modules/raml-json-enhance-node/lib/json-generator.js:60:26)
    at <anonymous>
error:  

In addition, other commands will fail to execute, for example: api-console generate-json helloworld.raml It will output the error message :

Required ` json` property not found.

api-console dev helloworld.raml It will output the error message:

[root@E355 code]# api-console dev helloworld.raml
error: /tmp/tmp-29867rM0umPaY9Qc8/node_modules/wct-local/scripts/postinstall.js:35
    selenium.install(config, function(error) {
            ^

TypeError: Cannot read property 'install' of undefined
    at /tmp/tmp-29867rM0umPaY9Qc8/node_modules/wct-local/scripts/postinstall.js:35:13
    at requireSelenium (/tmp/tmp-29867rM0umPaY9Qc8/node_modules/wct-local/scripts/postinstall.js:27:3)
    at Object.<anonymous> (/tmp/tmp-29867rM0umPaY9Qc8/node_modules/wct-local/scripts/postinstall.js:34:3)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:158:16)

  Required `json` property not found.

https://github.com/mulesoft-labs/api-console-cli/issues/23

jarrodek commented 6 years ago

Hi,

Thank you for the issue report. I have updated the api-console-cli module. Please update the CLI tool:

sudo npm i -g api-console-cli

and it will work. Sorry for a long wait time but it took me some time to find the problem (there were two separate issues related to this one).