mulesoft-labs / api-console-cli

A CLI tools for the API console.
Other
14 stars 15 forks source link

Running `api-console build` failed #23

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.
julien-lafont commented 6 years ago

Just for information, it's related to #18 and #21.

lanmolsz commented 6 years ago

@julien-lafont I downloaded the source code to my machine and ran the build command, though I get some error messages but I can build it successfully.

lanmolsz commented 6 years ago

@jarrodek I updated the latest version, the previous error was resolved. But got a new error(running api-console build xxx ):

info: Done.
(node:10392) UnhandledPromiseRejectionWarning: TypeError: file.isSymbolic is not a function
    at DestroyableTransform.normalize [as _transform] (D:\work\Nodejs\node_modules\api-console-cli\node_modules\vinyl-fs\lib\dest\prepare.js:31:15)
    at DestroyableTransform.Transform._read (D:\work\Nodejs\node_modules\api-console-cli\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:182:10)
    at DestroyableTransform.Transform._write (D:\work\Nodejs\node_modules\api-console-cli\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:170:83)
    at doWrite (D:\work\Nodejs\node_modules\api-console-cli\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:406:64)
    at writeOrBuffer (D:\work\Nodejs\node_modules\api-console-cli\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:395:5)
    at DestroyableTransform.Writable.write (D:\work\Nodejs\node_modules\api-console-cli\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:322:11)
    at Pumpify.Duplexify._write (D:\work\Nodejs\node_modules\api-console-cli\node_modules\duplexify\index.js:201:22)
    at doWrite (D:\work\Nodejs\node_modules\api-console-cli\node_modules\duplexify\node_modules\readable-stream\lib\_stream_writable.js:406:64)
    at writeOrBuffer (D:\work\Nodejs\node_modules\api-console-cli\node_modules\duplexify\node_modules\readable-stream\lib\_stream_writable.js:395:5)
    at Pumpify.Writable.write (D:\work\Nodejs\node_modules\api-console-cli\node_modules\duplexify\node_modules\readable-stream\lib\_stream_writable.js:322:11)
    at BuildBundler.ondata (_stream_readable.js:642:20)
    at BuildBundler.emit (events.js:159:13)
    at addChunk (_stream_readable.js:265:12)
    at readableAddChunk (_stream_readable.js:252:11)
    at BuildBundler.Readable.push (_stream_readable.js:209:10)
    at BuildBundler.Transform.push (_stream_transform.js:146:32)
    at BuildBundler.<anonymous> (D:\work\Nodejs\node_modules\api-console-cli\node_modules\polymer-build\lib\streams.js:217:30)
    at Generator.next (<anonymous>)
    at fulfilled (D:\work\Nodejs\node_modules\api-console-cli\node_modules\polymer-build\lib\streams.js:17:58)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
(node:10392) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 7)
(node:10392) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Still working...
Still working...
jarrodek commented 6 years ago

@lanmolsz it looks like vinyl library used by the Polymer build receives a null file. However, I can't reproduce this issue. Is the build fails (no build directory with console's sources)? What is node version?

ericwood73 commented 6 years ago

I got the same error. I'm running api-console in a docker container based on node:6

ericwood73 commented 6 years ago

It appears you can work around this if you have an index.html as api-console generate-json is working (at least for me).

julien-lafont commented 6 years ago

I've the same issue with the "Still working". I'll open a new issue for that

julien-lafont commented 6 years ago

Finally, an rm -Rf node_modules has solved the problem for me.