marcinwysocki / nestjs-typescript-boilerplate

A boilerplate for Nest project, including nodemon, TSLint and Prettier (for now)
5 stars 1 forks source link

package.json scripts error #1

Closed harishreddy-m closed 7 years ago

harishreddy-m commented 7 years ago

ENV

OS : windows 10 Node version: v6.10.3 yarn version : 0.24.5 Tried with npm as well npm version : 3.10.10

Description

Application is throwing TSError when tried to start with npm start or yarn start.But the application is starting when i run nodemon directly.

Logs

yarn run start yarn run v0.24.5 $ nodemon [nodemon] 1.11.0 [nodemon] to restart at any time, enter rs [nodemon] watching: D:\Coding\Nirguna\wannabee\server\src/*/ [nodemon] starting ts-node ./src/server.ts

D:\Coding\Nirguna\wannabee\server\node_modules\ts-node\src\index.ts:316 throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset)) ^ TSError: ⨯ Unable to compile TypeScript Cannot find type definition file for 'babel-core'. (2688) Cannot find type definition file for 'babel-template'. (2688) Cannot find type definition file for 'babel-traverse'. (2688) Cannot find type definition file for 'babel-types'. (2688) Cannot find type definition file for 'babylon'. (2688) Cannot find type definition file for 'express'. (2688) Cannot find type definition file for 'express-serve-static-core'. (2688) Cannot find type definition file for 'jest'. (2688) Cannot find type definition file for 'mime'. (2688) Cannot find type definition file for 'node'. (2688) Cannot find type definition file for 'serve-static'. (2688) src\server.ts (1,29): Cannot find module '@nestjs/core'. (2307) src\server.ts (2,26): Cannot find module 'express'. (2307) src\server.ts (3,25): Cannot find module 'morgan'. (2307) src\server.ts (4,35): Cannot find module './modules/app.module'. (2307) at getOutput (D:\Coding\Nirguna\wannabee\server\node_modules\ts-node\src\index.ts:316:17) at D:\Coding\Nirguna\wannabee\server\node_modules\ts-node\src\index.ts:347:18 at Object.compile (D:\Coding\Nirguna\wannabee\server\node_modules\ts-node\src\index.ts:500:17) at Module.m._compile (D:\Coding\Nirguna\wannabee\server\node_modules\ts-node\src\index.ts:410:44) at Module._extensions..js (module.js:579:10) at Object.require.extensions.(anonymous function) [as .ts] (D:\Coding\Nirguna\wannabee\server\node_modules\ts-node\src\index.ts:413:12) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Function.Module.runMain (module.js:604:10) [nodemon] app crashed - waiting for file changes before starting... Terminate batch job (Y/N)? Y

D:\Coding\Nirguna\wannabee\server>nodemon [nodemon] 1.11.0 [nodemon] to restart at any time, enter rs [nodemon] watching: D:\Coding\Nirguna\wannabee\server\src/*/ [nodemon] starting ts-node ./src/server.ts [Nest] 8732 - 6/29/2017, 7:38:19 AM [NestFactory] Starting Nest application... [Nest] 8732 - 6/29/2017, 7:38:19 AM [InstanceLoader] ApplicationModule dependencies initialized [Nest] 8732 - 6/29/2017, 7:38:19 AM [InstanceLoader] HelloModule dependencies initialized [Nest] 8732 - 6/29/2017, 7:38:19 AM [RoutesResolver] HelloController: [Nest] 8732 - 6/29/2017, 7:38:19 AM [RouterExplorer] Mapped {/, GET} route [Nest] 8732 - 6/29/2017, 7:38:19 AM [RouterExplorer] Mapped {/:name, GET} route [Nest] 8732 - 6/29/2017, 7:38:19 AM [NestApplication] Nest application is ready! Application is listening on port 3000.

marcinwysocki commented 7 years ago

What version of typescript do you have? I only managed to reproduce it with typescipt@2.4.1.

This seems to be related to https://github.com/Microsoft/TypeScript/issues/16772 and how TypeScript v2.4.1 resolves @types. That's what I was able to find today - downgrading to v2.4.0 fixed this issue for me.

I'm closing for now as it seems more on ts-node's side to fix this and there's already a PR https://github.com/TypeStrong/ts-node/pull/366.

harishreddy-m commented 7 years ago

Thank you.