mulesoft-labs / raml-javascript-generator

Generate a JavaScript API client from RAML
Other
32 stars 18 forks source link

require('raml-javascript-generator') fails on windows #11

Open cmorrisonSMS opened 8 years ago

cmorrisonSMS commented 8 years ago

Hi,

I have done npm install raml-javascript-generator, however, when I attempt to actually require in the library in a script, it is failing:

This:

jsGen = require('raml-javascript-generator');
var output = jsGen.client("raw.raml");

Fails with this:

C:\devel\raml-generator-test
λ node .\index.js
module.js:341
    throw err;
    ^

Error: Cannot find module 'raml-javascript-generator'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (C:\devel\raml-generator-test\index.js:1:71)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)

require('raml-javascript-generator/dist') appears to work (followed by other errors), but it not what the readme says, so seems incorrect.

Any help would be appreciated.

blakeembrey commented 8 years ago

Looks like package.json has an outdated main. However, when you change it to /dist it's probably breaking because it doesn't accept a string, it accepts an object. Why not just use the CLI?