microsoft / dts-gen

dts-gen creates starter TypeScript definition files for any module or library.
MIT License
2.44k stars 102 forks source link

Unexpected crash! - @google-cloud/compute #103

Open mattwelke opened 6 years ago

mattwelke commented 6 years ago

I got this error message when trying to generate types for the @google-cloud/compute package:

$ dts-gen -m @google-cloud/compute

Unexpected crash! Please log a bug with the commandline you specified.
/home/mwelke/.config/yarn/global/node_modules/dts-gen/bin/lib/run.js:130
        throw e;
        ^

Error: ENOENT: no such file or directory, open '@google-cloud/compute.d.ts'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.writeFileSync (fs.js:1291:33)
    at Object.<anonymous> (/home/mwelke/.config/yarn/global/node_modules/dts-gen/bin/lib/run.js:112:12)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)

My first suspicion was that this was an issue with me using Yarn instead of NPM, so I tried generating types for the yargs package in the readme example. That actually worked fine:

$ dts-gen -m yargs
Wrote 141 lines to yargs.d.ts.

In both cases, I made sure to install the packages globally as per the readme instructions before running the dts-gen command to generate types for them.

Could this be an issue with this particular package?

My info:

@google-cloud/compute version: 0.10.0 yarn version: 1.5.1 Node version: 8.9.4

Naatan commented 6 years ago

Running into the same issue with @emmetio/abbreviation

Naatan commented 6 years ago

Seems the problem is the forward slash, you can work around the issue by manually specifying the output file with -f.

mattwelke commented 6 years ago

I don't think the -f workaround worked for me. I used it with the @google-cloud/compute NPM module I tried to generate types for before and it only produced three lines:

> dts-gen -m @google-cloud/compute -f out
Wrote 3 lines to out.d.ts.

The three lines don't appear to describe types meaningfully:

/** Declaration file generated by dts-gen */

export = @google_cloud/compute;
Naatan commented 6 years ago

I actually got the same thing, thought that's a different issue than the one that was initially reported here.

Is this project still supported? The original issue was reported 15 days ago and it has yet to receive a response.

carlos-bernal-gby commented 6 years ago

Had the same problem but with the @google-cloud/bigquery module. I've opened a new issue #107 describing that a d.ts file is generated but the content doesn't make sense.

yanniks commented 6 years ago

Any updates on this?