nestjs / typescript-starter Goto Github PK
View Code? Open in Web Editor NEWNest framework TypeScript starter :coffee:
Home Page: https://nestjs.com
Nest framework TypeScript starter :coffee:
Home Page: https://nestjs.com
ts-node 4.x
has issues when the terminal ts-node is running on gets exited not using CTRL
+C
(e.g. close the terminal). This means that the server continues to run in the background, the developer must identify the process id on the port and only then can completely terminate the process. Otherwise he receives an 'EADDRINUSE, Address already in use' error when the application is started again.
Bumping the ts-node version to 6 will fix this issue.
Please upgrade ts-node to latest to fix it
tsconfig.json
is existing in this repo, but tslint would not work before installing manually.
Is this behavior intended?
like this project https://github.com/patrickhousley/nest-angular-universal
If officials build one, we can get more timely support. more people pr.
Many older TSLint editor plugins are deprecated in favour of the typescript-tslint-plugin
. This requires a tiny bit of configuration in tsconfig.json
, which should probably be implemented in the starter.
Hello @kamilmysliwiec ,
Could you provide more detailed examples for usage of framework in TS ?
It would be cool to have a description of debugging the app when developed in ts and used with ts-node ( How do you use it?)
Some patterns would be also good for:
A better description, for authenticating roles before route controller would be hit would be welcomed.
Thanks in advance,
Danny
Generate new repositories with repository templates
Github introduced repository templates to make boilerplate code management and distribution a first-class citizen on GitHub.
When Enabled on repo, Which will create Use this template button on GitHub repo, like this:
more info can be found here, https://github.blog/2019-06-06-generate-new-repositories-with-repository-templates/
Hello,
I would like to explain how I achieved to use VSCode debug tools while running my app in a Docker container because it took me some tricks to succeed, where could I explain the procedure and can I create a PR to push the modifications ?
Here are the changes that I would like to add :
start:debug-docker
, using tsc
and then launching the app with node
in inspect mode because ts-node
in inspect mode has strange behaviours (the breakpoints in VSCode are detected but not triggered) even with a good files mapping in the launch.json
filelaunch.json
configuration using attach
to attach the container's Node inspect websocketThanks for the awesome tools that you create, hoping that I can help someone trying to achieve the same thing than me ๐
With the latest release of Visual Studio Code - a new feature called Auto Attach was introduced.
To debug your NestJS app enable Auto Attach and edit nodemon.json file to look like this
{
"watch": ["src"],
"ext": "ts",
"ignore": ["src/**/*.spec.ts"],
"exec": "node --inspect-brk -r ts-node/register src/main.ts"
}
Now just run yarn start:dev
and happy hacking!
src/server.ts (5,5): Property 'listen' does not exist on type 'Promise<INestApplication>'. (2339)
at getOutput (/Users/ochervak/Projects/nest-typescript-starter/node_modules/ts-node/src/index.ts:307:15)
at /Users/ochervak/Projects/nest-typescript-starter/node_modules/ts-node/src/index.ts:336:16
at Object.compile (/Users/ochervak/Projects/nest-typescript-starter/node_modules/ts-node/src/index.ts:496:11)
at Module.m._compile (/Users/ochervak/Projects/nest-typescript-starter/node_modules/ts-node/src/index.ts:392:43)
at Module._extensions..js (module.js:579:10)
at Object.require.extensions.(anonymous function) [as .ts] (/Users/ochervak/Projects/nest-typescript-starter/node_modules/ts-node/src/index.ts:395:12)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
When I try to start application on debug mode nest start --debug 0.0.0.0
from docker and connect to debugger via chrome-inspector I can only see .js
files there but no .ts
files.
Branch to reproduce: https://github.com/Bilchuck/typescript-starter
Run docker-compose up
Current package.json dev packages has strict references to [email protected] e.g.
warning " > @nestjs/[email protected]" has incorrect peer dependency "[email protected]".
warning " > @nestjs/[email protected]" has incorrect peer dependency "[email protected]".
warning " > @nestjs/[email protected]" has incorrect peer dependency "[email protected]".
warning " > @nestjs/[email protected]" has incorrect peer dependency "[email protected]".
Let's change reference in package.json to "reflect-metadata": "0.1.10" or remove this strict reference inside packages
@nestjs/[email protected]
@nestjs/[email protected]
@nestjs/[email protected]
@nestjs/[email protected]
Created new project using nest cli and running npm run start:debug command but it is just sitting and doing nothing npm run start:dev works but then no debugging
with npm run start:debug the output is coming as below
This should be fix as per #37 but still not fixed and mentioned bug #37 should be reopen
Hello,
I have some issues running this script. I just cloned it on my local machine, i run:
npm install
and then i run :
npm run start
And I have this error :
internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module 'C:\Users\Bruce'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
I did nothing else, and I really don't understand why... Moreover this error only appears on windows. Could you help me ?
Thanks !
I've started playing with nestjs, and specially, with this starter kit, and I've been a bit surprised seeing how you combine both tabs and spaces in the typescript files.
Also, the indent tslint option is disabled, and I think it shoulld be enabled to, at least, define the usage of spaces (not to say there are also files with 4 spaces instead of 2..).
As said, am a newbie, but I don't think this is correct. Is there any specific reason why you made it this way?
The first space is not being removed.
In app.service.ts the root ()
method is returning the string Hello World!
. Returning the information, the space disappears. In my tests apparently only the first space is removed.
Doesnt rimraf belong in devDependencies
As title is suggesting I don't see any reason why rimraf
library should be part of dependencies
. It is dependency of prestart:prod
script, but I don't see that we are using it anywhere else in project. So I would like to move it to devDependencies
.
at code
there is no .nestcli.json file existing, so for example
nest g co about
command returning error.
nest g co about
(node:16896) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'c:\ozel\nestjs\apps\nestjs-ts-starter-orig.nestcli.json'
(node:16896) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:16896) [DEP0018] 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.
Hello there,
I followed the tutorial to create a role guard with reflector injected https://docs.nestjs.com/guards
At runtime, nest throws an exception where we call .get() like so.
const roles = this.reflector.get<string[]>('roles', handler);
Looks like injector was not made available.
[Nest] 5448 - 2018-2-2 13:23:52 [ExceptionsHandler] Cannot read property 'get' of undefined
TypeError: Cannot read property 'get' of undefined at RoleGuard.canActivate (C:\Users\nest\project\src\core\role.guard.ts:11:34) https://docs.nestjs.com/guards
Can you pls check it out?
Dependencies/versions in package.json
"dependencies": {
"@nestjs/common": "^4.5.9",
"@nestjs/core": "^4.5.10",
"@nestjs/microservices": "^4.5.8",
"@nestjs/testing": "^4.5.5",
"@nestjs/websockets": "^4.5.8",
"@types/express-jwt": "0.0.38",
"body-parser": "^1.18.2",
"express-jwt": "^5.3.0",
"jwks-rsa": "^1.2.1",
"redis": "^2.7.1",
"reflect-metadata": "^0.1.12",
"rxjs": "^5.5.6",
"typescript": "^2.6.2"
}
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
The start:prod
script rebuilds built sources each time (via the prestart:prod
script)
This script should run node without re-building
start:prod
Current implementation doesn't make sense. Both commands start
and start:prod
forces you to wait until sources are built.
In my opinion it's better to keep sources for the production mode, to save time.
I suggest moving rimraf dist
command before build
, and don't run build
before start:prod
.
Nest version: 6.1.1
For Tooling issues:
- Node version: v8.15.0
- Platform: Mac
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] (C:\Users\svak2\code\node_spikes\nest_starter\node_modules\ts-node\src\index.ts:404: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. (C:\Users\svak2\code\node_spikes\nest_starter\node_modules@nestjs\core\index.js:14:17)
at Module._compile (module.js:409:26)
Hi Kamil,
I hope this can helpful to others using NestJS. An hour ago I installed NestJs in a new project. When I ran $npm run test:e2e the "Test suite failed to run. error TS2349".
This is what I did to solve this issue:
a) Updated "jest" from v23.6.0 to v24.8.0
b) Edited line from "import * as request from 'supertest'; " to "import request from 'supertest'; "
Then the test:e2e: "PASS => Ran all test suites"
Regards and thanks for the NestJs platform.
Ronald
How i can debug in Webstorm with nodemon ?
Hi! I'm trying to deploy my first NestJS application and I may be doing something wrong. I can't find the documentation about building for production on the NestJS website.
From the available npm scripts, I've built the application using the build
script and I'm trying to run it using the start:prod
script. What bugs me is why do we have a prestart:prod
script that removes the whole dist folder? The start:prod
script can't start anything without it.
I suppose this is a bug and that the prestart:prod
script is indeed a prebuild
script. I'll gladly submit a PR if someone from the team confirms that bug.
[ ] Regression
[ ] Bug report
[ X ] Feature request
paths
section in tsconfig.json is ignored by ts-node, you will need tsconfig-paths for it.
'paths' section will be recognized
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@shared/*": [
"../shared/*"
],
"@libs/*": [
"../libs/*"
]
}
},
...
import { Foo } from '@shared/foo'
--> Module not found
so the whole tslint.json
file seems useless
besides, using the tslint:recommended
base configuration and overriding each rules with false
seems to be "not recommended" to me
Cannot find module '@nestjs/core/errors/exceptions/microservices-package-not-found.exception' from 'testing-module.js'
In order to be able to run start:prod
I needed to move @types/node
from devDependencies
to dependencies
otherwise I got the following error:
> [email protected] prestart:prod /usr/src/app
> rm -rf dist && tsc
node_modules/@nestjs/common/interfaces/external/mqtt-options.interface.d.ts(1,23): error TS2688: Cannot find type definition file for 'node'.
node_modules/@nestjs/common/interfaces/external/mqtt-options.interface.d.ts(96,31): error TS2304: Cannot find name 'Buffer'.
node_modules/@nestjs/common/interfaces/external/mqtt-options.interface.d.ts(96,40): error TS2304: Cannot find name 'Buffer'.
node_modules/@nestjs/common/interfaces/external/mqtt-options.interface.d.ts(100,32): error TS2304: Cannot find name 'Buffer'.
node_modules/@nestjs/common/interfaces/external/mqtt-options.interface.d.ts(100,41): error TS2304: Cannot find name 'Buffer'.
node_modules/@nestjs/common/interfaces/external/mqtt-options.interface.d.ts(104,30): error TS2304: Cannot find name 'Buffer'.
node_modules/@nestjs/common/interfaces/external/mqtt-options.interface.d.ts(104,39): error TS2304: Cannot find name 'Buffer'.
node_modules/@nestjs/common/interfaces/external/multer-options.interface.d.ts(1,23): error TS2688: Cannot find type definition file for 'node'.
node_modules/@nestjs/common/interfaces/external/multer-options.interface.d.ts(49,17): error TS2304: Cannot find name 'Buffer'.
node_modules/@nestjs/common/interfaces/http/http-server.interface.d.ts(1,23): error TS2688: Cannot find type definition file for 'node'.
node_modules/@nestjs/common/interfaces/http/http-server.interface.d.ts(2,49): error TS2307: Cannot find module 'http'.
node_modules/@nestjs/common/interfaces/nest-fastify-application.interface.d.ts(1,23): error TS2688: Cannot find type definition file for 'node'.
node_modules/@nestjs/common/interfaces/nest-fastify-application.interface.d.ts(45,33): error TS2304: Cannot find name 'Buffer'.
node_modules/@nestjs/common/interfaces/nest-fastify-application.interface.d.ts(63,17): error TS2304: Cannot find name 'Buffer'.
node_modules/@nestjs/core/nest-application.d.ts(1,23): error TS2688: Cannot find type definition file for 'node'.
node_modules/@nestjs/core/nest-application.d.ts(10,23): error TS2307: Cannot find module 'http'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] prestart:prod: `rm -rf dist && tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] prestart:prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
The very first time after clonning this repo, you won't be able to run npm run start:prod
due to the changes done in this commit
Do I have to run npm run build
before? or there is some missing 'prestart:prod' script?
The current version ( in package.json ) ignores settings like
noUnusedLocals
noUnusedParameters
etc
I don't know why only some are ignored.
Just started using the framework and noticed that both tslint and prettier are setup, but aren't working with each other. By default they play nice, however if the tslint or prettier settings are changed they can conflict with one another. There's a module called tslint-config-prettier
that integrates both settings together so these always play nice. This means the settings can be updated without issue :)
It sounds like ESLint is making a major push towards Typescript
https://eslint.org/blog/2019/01/future-typescript-eslint
which is supported by the Typescript roadmap
microsoft/TypeScript#29288
Is it ready enough to start switching?
[ ] Regression
[x ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Jest has detected the following 1 open handle potentially keeping Jest from exiting:
โ TCPSERVERWRAP
18 | it('/ (GET)', () => {
19 | return request(app.getHttpServer())
> 20 | .get('/')
| ^
21 | .expect(200)
22 | .expect('Hello World!');
23 | });
at Test.Object.<anonymous>.Test.serverAddress (../node_modules/supertest/lib/test.js:59:33)
at new Test (../node_modules/supertest/lib/test.js:36:12)
at Object.obj.(anonymous function) [as get] (../node_modules/supertest/index.js:25:14)
at Object.it (app.e2e-spec.ts:20:8)
Expected the e2e test to run successfully
nest new nest-test
cd nest-test
npm run test:e2e -- --detectOpenHandles
proper e2e testing
Nest version: @nestjs/[email protected]
For Tooling issues:
- Node version: XX
- Platform:
Others:
The basic setup resulted in a 404 at localhost:3000.
$ npm startยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
> [email protected] start /home/mclayton/projects/nest-typescript-starterยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
> node index.jsยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
[Nest] 10154 - 5/23/2017, 10:18:46 AM [NestFactory] Starting Nest application...ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
[Nest] 10154 - 5/23/2017, 10:18:46 AM [InstanceLoader] ApplicationModule dependencies initializedยท
[Nest] 10154 - 5/23/2017, 10:18:46 AM [NestApplication] Nest application is ready!ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
Application is listening on port 3000.ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
It seems to be ready, but...
$ curl -I localhost:3000
HTTP/1.1 404 Not Found
X-Content-Type-Options: nosniff
Content-Type: text/html; charset=utf-8
Content-Length: 14
Date: Tue, 23 May 2017 14:18:52 GMT
Connection: keep-alive
Node: v6.10.2
npm: 3.10.10
This error is displayed after running npm run start.
I followed the steps under "installation" at https://docs.nestjs.com/
the full error is as follows:
Error: Cannot find module 'rxjs/Observable/of'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
at Function.Module._resolveFilename (/home/david/git/nest/test/node_modules/tsconfig-paths/lib/register.js:31:40)
at Function.Module._load (internal/modules/cjs/loader.js:475:25)
at Module.require (internal/modules/cjs/loader.js:598:17)
at require (internal/modules/cjs/helpers.js:11:18)
at Object.<anonymous> (/home/david/git/nest/test/src/main.ts:7:1)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Module.m._compile (/home/david/git/nest/test/node_modules/ts-node/src/index.ts:422:23)
at Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Object.require.extensions.(anonymous function) [as .ts] (/home/david/git/nest/test/node_modules/ts-node/src/index.ts:425:12)
I've got quite a lot of warnings from NPM when installing current version. Could the core dependencies be bumped up? (@nestjs/....
)
Thanks!
Just getting "ENOENT: no such file or directory, open 'protorepo/UserService/UserService.proto'" when trying to npm run start:dev
. I think the commit may have been meant for a different branch.
There's a bunch of stuff that got added to main.ts using protos and what not, so I reverted that file locally and things are working again.
I should add https://github.com/1140lex/protorepo.git is 404 for me and a submodule is pointing to it
I noticed that this starter places typescript in dependencies not devDependencies. Is this a subtle requirement or could typescript be moved to devDependencies?
While running npm install, jest package seems to be having a vulnerable handlebar dependency. The fix is availabe , I can do pr if you like
How can fix this issue? Thanks.
โ project git:(master) sudo npm install
Password:
module.js:515
throw err;
^
Error: Cannot find module 'aproba'
at Function.Module._resolveFilename (module.js:513:15)
at Function.Module._load (module.js:463:25)
at Module.require (module.js:556:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npmlog/node_modules/gauge/render-template.js:3:16)
at Module._compile (module.js:612:30)
at Object.Module._extensions..js (module.js:623:10)
at Module.load (module.js:531:32)
at tryModuleLoad (module.js:494:12)
at Function.Module._load (module.js:486:3)
โ project git:(master) subl .
โ project git:(master) npm i
module.js:515
throw err;
^
Error: Cannot find module 'aproba'
at Function.Module._resolveFilename (module.js:513:15)
at Function.Module._load (module.js:463:25)
at Module.require (module.js:556:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npmlog/node_modules/gauge/render-template.js:3:16)
at Module._compile (module.js:612:30)
at Object.Module._extensions..js (module.js:623:10)
at Module.load (module.js:531:32)
at tryModuleLoad (module.js:494:12)
at Function.Module._load (module.js:486:3)
โ project git:(master)
I get this is error with zero configuration:
/app/backend/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)
As the maintainer of several open source projects myself in addition to having a full-time job and family, time is sometimes in short supply. Fortunately, my wife is a very understanding, kind soul who gives me plenty of time to code :)
I, and I'm sure other, would like to be able to contribute to Nest and keep it moving forward. Would you be interested in bringing on some additional maintainers?
I've made a clone of the master branch. Then followed the instructions from readme:
npm run webpack
npm run start:hmr
When I change the "Hello world" in the App.Service the app opened in chrome is not reloading automatically. Also theres no network activity that would show it even tried to reload. Am I missing some kind of step or its not supposed to autoreload when I change anything and save the file?
Im on Windows 10, npm 5.8.0, node v8.11.1
Hi,
Given this test
describe('AppController (e2e)', () => {
let app: INestApplication;
beforeAll(async () => {
const moduleFixture = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
afterAll(async () => {
await app.close();
});
it('/post /graphql', async () => {
return request(app.getHttpServer())
.post('/graphql')
.send({
query: `{
users {
id
}
}`,
})
.expect(200)
.expect('{"data":{"users":[{"id":9}]}}');
});
});
When I run jest, the process does not exit after the tests finish:
I've tried to call app.close()
in the afterAll
jest hook but it does not work.
Hi, I llike this frame work very much.. but im with trouble, how to config the socket io with the framework.. i try to use interface..
if you can give some example that is better
thank you
Absolute import paths like importย { foo } from 'src/utils/foo'
work great with ts-node
, but fail when running npm run start:prod
.
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module 'src/utils/foo'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._resolveFilename (/Users/patrick/r/typescript-starter/node_modules/tsconfig-paths/lib/register.js:75:40)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/Users/patrick/r/typescript-starter/dist/main.js:13:15)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
Here is a fork of typescript-starter
with minimal changes to reproduce the issue. Compare changes.
The start:prod
command is already changed to include the tsconfig-paths/register
module, from
{
"start:prod": "node dist/main.js"
}
to
{
"start:prod": "node -r tsconfig-paths/register dist/main.js"
}
unfortunately without any effect.
When builds try to compiler the Typescript Im getting that looks like the Module definition.
Impacted File: app.module.ts (the main core module)
Terminal Error:
17:20:50 Object literal may only specify known properties, and 'imports' does not exist in type '{ modules?: any[]; controllers?: any[]; components?: any[]; exports?: any[]; }'.
Node Version: 9.0.0
Package.json
"dependencies": {
"@nestjs/common": "^4.0.2",
"@nestjs/core": "^4.0.2",
"@nestjs/microservices": "^4.0.2",
"@nestjs/swagger": "^1.1.3",
"@nestjs/testing": "^4.0.2",
"@nestjs/websockets": "^4.0.2",
"@types/morgan": "^1.7.35",
"aws-sdk": "^2.180.0",
"cookie-parser": "^1.4.3",
"jsrsasign": "^8.0.4",
"lodash.defaultsdeep": "~4.6.0",
"morgan": "^1.9.0",
"reflect-metadata": "^0.1.10",
"rxjs": "^5.4.3"
},
"devDependencies": {
"@types/chai": "^4.0.2",
"@types/express": "^4.0.36",
"@types/mocha": "^2.2.41",
"@types/node": "^9.3.0",
"@types/sinon": "^2.3.3",
"chai": "^4.1.1",
"mocha": "^3.5.0",
"nodemon": "^1.11.0",
"sinon": "^2.4.1",
"ts-node": "^4.1.0",
"tsconfig-paths": "^3.1.1",
"typescript": "^2.4.2"
}
Fo some reason, you can't path map with the 'tsconfig.ts' files like one can do in the Angular-CLI projects. I'm wondering if this is a 'ts-node' issue where you need to use 'tsconfig-paths'? If so, Angular-CLI uses 'ts-node' with no dependency that I know of using 'tsconfig-paths'. This is an odd issue with out much documentation on the subject. Any ideas what's going on?
When you run the tsc --traceResolution
command the paths still don't show that they have resolved either.
TypeScript Version
2.6.2
Command Executed
tsc
Terminal Compiling Error:
error TS2307: Cannot find module '@env'.
Trace Resolution Error
Resolving module name '@env' relative to base url '/Users/chris.c/Documents/workspace/app/backend/src' - '/Users/chris.c/Documents/workspace/app/backend/src/@env'.
tsconfig.ts file:
`
"compilerOptions": {
"declaration": false,
"outDir": "./dist",
"module": "commonjs",
"target": "es6",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"rootDir": ".",
"baseUrl": "src",
"paths": {
"@env/*": ["environments/*"]
},
"typeRoots": [
"node_modules/@types"
]
},
"exclude": [
"node_modules",
"**/*.spec.ts"
]
`
can we update packages to latest versions, if this dont causes any problems?
{
"name": "nest-typescript-starter",
"version": "1.0.0",
"description": "Nest TypeScript starter repository",
"license": "MIT",
"scripts": {
"format": "prettier --write "src/**/*.ts"",
"start": "ts-node -r tsconfig-paths/register src/main.ts",
"start:dev": "nodemon",
"start:debug": "nodemon --config nodemon-debug.json",
"prestart:prod": "rimraf dist && tsc",
"start:prod": "node dist/main.js",
"start:hmr": "node dist/server",
"lint": "tslint -p tsconfig.json -c tslint.json",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:e2e": "jest --config ./test/jest-e2e.json",
"webpack": "webpack --config webpack.config.js"
},
"dependencies": {
"@nestjs/common": "^5.1.0",
"@nestjs/core": "^5.1.0",
"@nestjs/microservices": "^5.1.0",
"@nestjs/testing": "^5.1.0",
"@nestjs/websockets": "^5.1.0",
"reflect-metadata": "^0.1.12",
"rxjs": "^6.2.2",
"typescript": "^2.8.0"
},
"devDependencies": {
"@types/express": "^4.16.0",
"@types/jest": "^23.3.1",
"@types/node": "^10.5.5",
"@types/supertest": "^2.0.5",
"jest": "^23.4.2",
"nodemon": "^1.18.3",
"prettier": "^1.14.0",
"rimraf": "^2.6.2",
"supertest": "^3.1.0",
"ts-jest": "^23.0.1",
"ts-loader": "^4.4.2",
"ts-node": "^7.0.0",
"tsconfig-paths": "^3.5.0",
"tslint": "^5.11.0",
"webpack": "^4.16.3",
"webpack-cli": "^3.1.0",
"webpack-node-externals": "^1.7.2",
"ajv": "^6.5.2"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".spec.ts$",
"transform": {
"^.+\.(t|j)s$": "ts-jest"
},
"coverageDirectory": "../coverage"
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.