{"action":"created","issue":{"url":"https://api.github.com/repos/typeorm/typeorm/issues/371","repository_url":"https://api.github.com/repos/typeorm/typeorm","labels_url":"https://api.github.com/repos/typeorm/typeorm/issues/371/labels{/name}","comments_url":"https://api.github.com/repos/typeorm/typeorm/issues/371/comments","events_url":"https://api.github.com/repos/typeorm/typeorm/issues/371/events","html_url":"https://github.com/typeorm/typeorm/issues/371","id":217028137,"node_id":"MDU6SXNzdWUyMTcwMjgxMzc=","number":371,"title":"Migration cli unexpected token import","user":{"login":"adithep","id":6279977,"node_id":"MDQ6VXNlcjYyNzk5Nzc=","avatar_url":"https://avatars0.githubusercontent.com/u/6279977?v=4","gravatar_id":"","url":"https://api.github.com/users/adithep","html_url":"https://github.com/adithep","followers_url":"https://api.github.com/users/adithep/followers","following_url":"https://api.github.com/users/adithep/following{/other_user}","gists_url":"https://api.github.com/users/adithep/gists{/gist_id}","starred_url":"https://api.github.com/users/adithep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adithep/subscriptions","organizations_url":"https://api.github.com/users/adithep/orgs","repos_url":"https://api.github.com/users/adithep/repos","events_url":"https://api.github.com/users/adithep/events{/privacy}","received_events_url":"https://api.github.com/users/adithep/received_events","type":"User","site_admin":false},"labels":[{"id":333605716,"node_id":"MDU6TGFiZWwzMzM2MDU3MTY=","url":"https://api.github.com/repos/typeorm/typeorm/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":21,"created_at":"2017-03-26T05:12:00Z","updated_at":"2018-12-24T11:43:30Z","closed_at":"2017-04-08T04:18:29Z","author_association":"NONE","body":"I wrote everything in typescript.\r\nThe application and everything work fine, but as soon as I call \r\n\r\n`typeorm migrations:run`\r\n\r\nI get this error\r\n\r\nsrc/entity/User.ts:1\r\n(function (exports, require, module, __filename, __dirname) { import {Entity, Column, PrimaryGeneratedColumn} from \"typeorm\";\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 Object.Module._extensions..js (module.js:580:10)\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 Function.PlatformTools.load (/usr/local/lib/node_modules/typeorm/platform/PlatformTools.js:26:20)\r\n    at /usr/local/lib/node_modules/typeorm/util/DirectoryExportedClassesLoader.js:29:69\r\n(node:38469) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): SyntaxError: Unexpected token import\r\n(node:38469) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.\r\n\r\nNot sure if it matters but this is my tsconfig.json:\r\n\r\n{\r\n  \"compilerOptions\": {\r\n    \"declaration\": true,\r\n    \"emitDecoratorMetadata\": true,\r\n    \"experimentalDecorators\": true,\r\n    \"isolatedModules\": false,\r\n    \"module\": \"commonjs\",\r\n    \"moduleResolution\": \"node\",\r\n    \"outDir\": \"dist\",\r\n    \"sourceMap\": true,\r\n    \"sourceRoot\": \"src\",\r\n    \"noEmitHelpers\": false,\r\n    \"target\": \"es5\",\r\n    \"typeRoots\": [\r\n      \"node_modules/@types\"\r\n    ],\r\n    \"lib\": [\"es6\", \"dom\"]\r\n  },\r\n  \"exclude\": [\r\n    \"node_modules\"\r\n  ]\r\n}\r\n\r\nWhat ever I change in tsconfig.json seems to not effect the error at all.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/typeorm/typeorm/issues/comments/449723910","html_url":"https://github.com/typeorm/typeorm/issues/371#issuecomment-449723910","issue_url":"https://api.github.com/repos/typeorm/typeorm/issues/371","id":449723910,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0OTcyMzkxMA==","user":{"login":"AhmadDeel","id":39188688,"node_id":"MDQ6VXNlcjM5MTg4Njg4","avatar_url":"https://avatars0.githubusercontent.com/u/39188688?v=4","gravatar_id":"","url":"https://api.github.com/users/AhmadDeel","html_url":"https://github.com/AhmadDeel","followers_url":"https://api.github.com/users/AhmadDeel/followers","following_url":"https://api.github.com/users/AhmadDeel/following{/other_user}","gists_url":"https://api.github.com/users/AhmadDeel/gists{/gist_id}","starred_url":"https://api.github.com/users/AhmadDeel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AhmadDeel/subscriptions","organizations_url":"https://api.github.com/users/AhmadDeel/orgs","repos_url":"https://api.github.com/users/AhmadDeel/repos","events_url":"https://api.github.com/users/AhmadDeel/events{/privacy}","received_events_url":"https://api.github.com/users/AhmadDeel/received_events","type":"User","site_admin":false},"created_at":"2018-12-24T11:43:30Z","updated_at":"2018-12-24T11:43:30Z","author_association":"NONE","body":"after long I installed ts-node typescript typeorm globally and use\r\n`ts-node ./node_modules/typeorm/cli.js  migration:generate -n new1`\r\ncommand things start to work.\r\nthen added these\r\n```js\r\n> {\r\n>   /* ... */\r\n\"scripts\": {\r\n>     /* ... */\r\n>     \r\n      \"typeorm-migration-generate\": \"ts-node ./node_modules/typeorm/cli.js migration:generate -n MigrationName\",\r\n      \"typeorm-migration-run\": \"ts-node ./node_modules/typeorm/cli.js migration:run\",\r\n      \"typeorm-migration-revert\": \"ts-node ./node_modules/typeorm/cli.js migration:revert\"\r\n>   }\r\n> }\r\n> ```\r\n"}}
{"actor":{"display_login":"AhmadDeel"}}