{"action":"closed","issue":{"url":"https://api.github.com/repos/TypeStrong/ts-node/issues/250","repository_url":"https://api.github.com/repos/TypeStrong/ts-node","labels_url":"https://api.github.com/repos/TypeStrong/ts-node/issues/250/labels{/name}","comments_url":"https://api.github.com/repos/TypeStrong/ts-node/issues/250/comments","events_url":"https://api.github.com/repos/TypeStrong/ts-node/issues/250/events","html_url":"https://github.com/TypeStrong/ts-node/issues/250","id":195912238,"number":250,"title":"ts-node doesn't work when installed as -g in a package","user":{"login":"egandro","id":2846575,"avatar_url":"https://avatars.githubusercontent.com/u/2846575?v=3","gravatar_id":"","url":"https://api.github.com/users/egandro","html_url":"https://github.com/egandro","followers_url":"https://api.github.com/users/egandro/followers","following_url":"https://api.github.com/users/egandro/following{/other_user}","gists_url":"https://api.github.com/users/egandro/gists{/gist_id}","starred_url":"https://api.github.com/users/egandro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/egandro/subscriptions","organizations_url":"https://api.github.com/users/egandro/orgs","repos_url":"https://api.github.com/users/egandro/repos","events_url":"https://api.github.com/users/egandro/events{/privacy}","received_events_url":"https://api.github.com/users/egandro/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-15T20:48:58Z","updated_at":"2016-12-15T21:10:49Z","closed_at":"2016-12-15T21:10:49Z","body":"Hi!\r\n\r\nI am trying to create a small ts-node based CLI util. My intension is just to ship the ts files and avoid precompiling the application with js files.\r\n\r\nThis works fine when running in development in my $projectdir. However after installing the module via npm install -g the ts-node registration for .ts vanishes.\r\n\r\nVoila:\r\n\r\nfile: launcher.js\r\n\r\n#!/usr/bin/env node\r\nrequire('ts-node/register');\r\nrequire('./lib/cli.ts');\r\n\r\nfile: lib/cli.ts\r\n\r\nimport { TestClass } from './test';\r\nTestClass.hello();\r\n\r\nfile: lib/test.ts\r\n\r\nexport class TestClass {\r\n\tpublic static hello() {\r\n\t\tconsole.log('Hello from TestClass');\r\n\t}\r\n}\r\n\r\nfile: package.json\r\n\r\n{\r\n  \"name\": \"tscli\",\r\n  \"version\": \"1.0.0\",\r\n  \"bin\": {\r\n    \"tscli\": \"launcher.js\"\r\n  },\r\n  \"dependencies\": {\r\n    \"@types/node\": \"^6.0.52\",\r\n    \"ts-node\": \"1.7.2\",\r\n    \"typescript\": \"^2.1.4\",\r\n    \"typescript-require\": \"0.2.9-1\"\r\n  },\r\n  \"devDependencies\": {}\r\n}\r\n\r\n$ node launcher.js\r\nHello from TestClass\r\n\r\n$ sudo npm install tscli -g\r\n$ tscli\r\n\r\n/usr/local/lib/node_modules/tscli/lib/cli.ts:1\r\n(function (exports, require, module, __filename, __dirname) { import { TestClass } from './test';\r\n                                                              ^^^^^^\r\nSyntaxError: Unexpected token import\r\n    at Object.exports.runInThisContext (vm.js:78:16)\r\n    at Module._compile (module.js:543:28)\r\n    at Module._extensions..js (module.js:580:10)\r\n    at Object.require.extensions.(anonymous function) [as .ts] (/usr/local/lib/node_modules/tscli/node_modules/ts-node/dist/index.js:208:20)\r\n    at Module.load (module.js:488:32)\r\n    at tryModuleLoad (module.js:447:12)\r\n    at Function.Module._load (module.js:439:3)\r\n    at Module.require (module.js:498:17)\r\n    at require (internal/module.js:20:19)\r\n    at Object.<anonymous> (/usr/local/lib/node_modules/tscli/launcher.js:3:1)"}}
{"actor":{"display_login":"blakeembrey"}}