GithubHelp home page GithubHelp logo

Comments (11)

jfmlima avatar jfmlima commented on May 22, 2024 20

@felquis Doing this fixed my issues:
npm install --save @types/node@latest ts-node@latest --force

from typescript-starter.

adrien2p avatar adrien2p commented on May 22, 2024 3

Hey guys, You can also try this and give me your feedback starter kit implementation with sequelize and jwt

from typescript-starter.

felquis avatar felquis commented on May 22, 2024 2

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.

KatSick avatar KatSick commented on May 22, 2024 1

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.

Itrulia avatar Itrulia commented on May 22, 2024 1

fixing [email protected] and [email protected] fixes it for me.

from typescript-starter.

patricknazar avatar patricknazar commented on May 22, 2024

@felquis try yarn upgrade ts-node @types/node. Doing this solved it for me.

from typescript-starter.

julianmnst avatar julianmnst commented on May 22, 2024

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.

julianmnst avatar julianmnst commented on May 22, 2024

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.

kamilmysliwiec avatar kamilmysliwiec commented on May 22, 2024

Hi,
Fixed.

from typescript-starter.

yeria-t avatar yeria-t commented on May 22, 2024

Do not forget to import the decorator ;)

import {Headers} from '@nestjs/common';

from typescript-starter.

kenobi-io avatar kenobi-io commented on May 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.