k-maru / grunt-typescript

MIT License
137 stars 60 forks source link

Typescript must be installed locally? #96

Open Vadorequest opened 9 years ago

Vadorequest commented 9 years ago

If I don't install TypeScript locally like in my node_modules then it doesn't work:

Running "typescript:recursive" (typescript) task
Verifying property typescript.recursive exists in config...OK
Files: WebContent/scripts/widget/Api.ts, WebContent/scripts/widget/Spinner.ts, WebContent/scripts/widget/Template.ts
Warning: Cannot find module 'typescript' Use --force to continue.

Aborted due to warnings.

I do have TypeScript intalled globally, why do I need to have it locally as well?

Coridyn commented 9 years ago

It is standard practice to install package dependencies locally to avoid "dependency hell".

Here is a blog post discussing this: http://blog.timoxley.com/post/20772365842/node-js-npm-reducing-dependency-overheads

Both modules depend on underscore, yet both modules can depend on completely different versions of underscore! And they happily live beside each other without conflict.

Basically, it lets every module resolve the dependencies it needs, even if they would conflict with the dependencies of another module - because the dependency is local to that module.

It also means that updating your global TypeScript installation won't break projects that require an earlier version.