Comments (11)
@felquis Doing this fixed my issues:
npm install --save @types/node@latest ts-node@latest --force
from typescript-starter.
Hey guys, You can also try this and give me your feedback starter kit implementation with sequelize and jwt
from typescript-starter.
I fixed the problem with app.then
, but then I found this issue, and it looks similar to the problem I'm facing microsoft/TypeScript#16772
➜ nest-typescript-starter git:(master) ✗ yarn start 18:00:47
yarn start v0.24.5
$ node index.js
/home/felquis/code/nest-typescript-starter/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 'node'. (2688)
src/server.ts (1,29): Cannot find module '@nestjs/core'. (2307)
src/server.ts (2,35): Cannot find module './modules/app.module'. (2307)
at getOutput (/home/felquis/code/nest-typescript-starter/node_modules/ts-node/src/index.ts:316:17)
at /home/felquis/code/nest-typescript-starter/node_modules/ts-node/src/index.ts:347:18
at Object.compile (/home/felquis/code/nest-typescript-starter/node_modules/ts-node/src/index.ts:474:19)
at Module.m._compile (/home/felquis/code/nest-typescript-starter/node_modules/ts-node/src/index.ts:410:44)
at Module._extensions..js (module.js:580:10)
at Object.require.extensions.(anonymous function) [as .ts] (/home/felquis/code/nest-typescript-starter/node_modules/ts-node/src/index.ts:413:12)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
error Command failed with exit code 1.
from typescript-starter.
Looks like you need to change server.ts
with:
import { NestFactory } from '@nestjs/core';
import { ApplicationModule } from './modules/app.module';
const app = NestFactory.create(ApplicationModule);
app.then(instance => instance.listen(3000, () => console.log('Application is listening on port 3000')));
from typescript-starter.
fixing [email protected]
and [email protected]
fixes it for me.
from typescript-starter.
@felquis try yarn upgrade ts-node @types/node
. Doing this solved it for me.
from typescript-starter.
Just tried @Jflima92 's solution with no success. Got this error instead:
node index.js
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Module._extensions..js (module.js:416:10)
at Object.require.extensions.(anonymous function) [as .js] (/home/mpjm/Development/project/node_modules/ts-node/src/index.ts:384:14)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/mpjm/Development/project/node_modules/@nestjs/core/index.js:14:17)
at Module._compile (module.js:409:26)
Any ideas? Where's @kamilmysliwiec ? I'm really excited about Nest.
from typescript-starter.
Ok I reinstalled the project, had the first problem and then did npm install --save @types/node@latest ts-node@latest
without --force. Then I checked my package.json and saw that one package (don't remember wich) still had the * on it's version. npm suggested a version, I manually wrote it on package.json, npm install again and that solved it.
from typescript-starter.
Hi,
Fixed.
from typescript-starter.
Do not forget to import the decorator ;)
import {Headers} from '@nestjs/common';
from typescript-starter.
nodemon --config apps/api/nodemon-debug.json
[nodemon] 1.19.4
[nodemon] to restart at any time, enter rs
[nodemon] watching dir(s): apps/api/src/**/*
[nodemon] watching extensions: ts
[nodemon] starting node --inspect-brk -r ts-node/register -r tsconfig-paths/register ./apps/api/src/main.ts
Debugger listening on ws://127.0.0.1:9229/10fcf8fe-d379-4d87-9379-f03ca46ab57f
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached
src/main.ts:5
import * as tslib_1 from "tslib";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Module._compile (internal/modules/cjs/loader.js:892:18)
at Module.m._compile (node_modules/ts-node/src/index.ts:493:23)
at Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Object.require.extensions. [as .ts] (node_modules/ts-node/src/index.ts:496:12)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
at internal/main/run_main_module.js:17:11
from typescript-starter.
Related Issues (20)
- How to Debug NestJs in WebStorm HOT 1
- npm run start in clean project doesn't work HOT 3
- Lint script does not work as expected HOT 1
- tsconfig.json exclude setting is not necessary because it is already handled by defaults HOT 1
- TypeORM - Entity not loaded if specified in the ormconfig.json HOT 1
- Docker files are being ignored in .gitignore HOT 1
- Add "skipLibCheck": true, to tsconfig.json HOT 1
- `tsbuildinfo` should be removed in `prebuild` - `incremental` flag can cause hard to pin down errors HOT 1
- eslint-plugin-import is not actually used HOT 2
- Proposal: Add Dockerfile HOT 1
- Is tsconfig.build.json still needed ? HOT 3
- Incorrect import path HOT 2
- Makes sense have an example of Clean Architecture on this (or on other) repo implemented? HOT 1
- How to remove the Label "Nest framework TypeScript starter repository" in Swagger Doc? HOT 1
- What versions of node are compatible/supported? HOT 1
- TypeScript unsupported version by @typescript-eslint
- Imports order as a part of eslint and prettier HOT 2
- Add `lib` field in `tsconfig.json` to exclude dom related apis explicitly. HOT 3
- npm run start:prod thrown error. HOT 1
- How to create the starter using 'fastify' instead of 'express' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript-starter.