Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run tsoa when installed globally #4

Closed
danzel opened this issue Jul 24, 2016 · 5 comments
Closed

Cannot run tsoa when installed globally #4

danzel opened this issue Jul 24, 2016 · 5 comments

Comments

@danzel
Copy link
Contributor

danzel commented Jul 24, 2016

npm install -g tsoa
tsoa --help
module.js:442
    throw err;
    ^

Error: Cannot find module 'C:\Users\dave\AppData\Roaming\npm/package.json'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at getPackageJsonValue (C:\Users\dave\AppData\Roaming\npm\node_modules\tsoa\dist\cli.js:107:25)
    at Object.<anonymous> (C:\Users\dave\AppData\Roaming\npm\node_modules\tsoa\dist\cli.js:33:18)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.runMain (module.js:575:10)
    at run (bootstrap_node.js:352:7)
    at startup (bootstrap_node.js:144:9)
    at bootstrap_node.js:467:3

Doesn't work.

vs

npm install tsoa
node ./node_modules/tsoa/dist/cli.js --help
Usage: node_modules\tsoa\dist\cli.js <command> [options]

Commands:
  swagger  Generate swagger spec
  routes   Generate routes

Options:
  --help, -h  Show help                                                [boolean]

Works.

@danzel
Copy link
Contributor Author

danzel commented Jul 24, 2016

I'm on windows BTW.

@lukeautry
Copy link
Owner

I think there's a straightforward way to make this work for global
installs, but you lose some of the benefit of having it installed locally;
when you generate a swagger spec, some default values for the spec are
inferred from package.json.

That said it shouldn't blow up like this and I know why it's happening;
will put out a fix later today most likely.
On Jul 23, 2016 10:00 PM, "Dave Leaver" notifications@github.com wrote:

I'm on windows BTW.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#4 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AIXUAKrWNI1Ea_Df4yWHB-lMMfO_Hm75ks5qYsdUgaJpZM4JTe8t
.

@lukeautry
Copy link
Owner

lukeautry commented Jul 24, 2016

@danzel This is now fixed in 0.0.40

@danzel
Copy link
Contributor Author

danzel commented Jul 24, 2016

Thanks!
Maybe it could check the PWD that the command was ran from? Then it could still find the local package.json.

@lukeautry
Copy link
Owner

I think that's a pretty good idea, I'll most likely implement that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants