NestJs server does not start - node.js

when I run the start command in NestJs I got no error but a text repeats one after the other and won't let the server start.
This is the text
Debugger listening on ws://localhost:9229/d85c77f4-d1c6-4b88-a91a-1905252c8913
For help, see: https://nodejs.org/en/docs/inspector
chunk (runtime: main) main.js (main) 30.5 KiB [entry]
webpack compiled successfully (bdb03efc0de1a987)
No issues found.

Related

Need to constantly delete node_modules for Angular 9 app to work

I'm very new to web development and I'm trying to get familiar with building Angular forms. I'm running in to a problem where every time I start up an Angular project using npm start or ng serve and go to the localhost, it gives me an error "Cannot GET /".
If I close everything down, delete node_modules within the project folder, run npm install then npm start again, it will work. If I close the terminal and try to run the project again, I get back to the same error. Basically I can only run the project exactly one time before I have to go and repeat the process of deleting node_modules etc (which is even a pain in itself as I haven't found a quick way to delete node_modules.)
I'm using Windows and the April 2020 release of VS Code and Angular 9. Please let me know if I can provide any information re: code, files etc., as I said I'm pretty new to this and not really sure where I could look to try to fix this. Thank you!
Update: Here is what I have in the terminal. The error is at the bottom and it has to do with MatDialogRef, but to be honest I've just ignored this because I get this same error regardless, even if my project opens properly. I believe this error is caused by some changes they made to Angular 9, but I'm not sure how to fix it.
Update 2: I edited the path of MatDialogRef to #angular/materials/dialog, which fixed that error, but now I'm getting a whole bunch of errors of the same type which were not occurring before. Please see below.
ERROR in src/app/app-layer/app-layer.component.html:2:35 - error TS2339: Property 'isLinear' does not exist on type 'AppLayerComponent'.
2 <mat-vertical-stepper [linear] = "isLinear" #stepper>
~~~~~~~~
src/app/app-layer/app-layer.component.ts:6:16
6 templateUrl: './app-layer.component.html',
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error occurs in the template of component AppLayerComponent.
Below here is the original error which I fixed by adding /dialog
> app-frontend#0.0.0 start C:\Users\u123\Documents\Angular\app-frontend
> ng serve
chunk {main} main.js, main.js.map (main) 2.04 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 700 bytes [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 1.28 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 339 kB [initial] [rendered]
Date: 2020-05-20T18:57:35.818Z - Time: 16760ms
ERROR in node_modules/gcui/lib/delete-confirmation-dialog/delete-confirmation-dialog.component.d.ts:1:30 - error TS2306: File 'C:/Users/u123/Documents/Angular/app-frontend/node_modules/#angular/material/index.d.ts' is not a module.
1 import { MatDialogRef } from '#angular/material';
~~~~~~~~~~~~~~~~~~~
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
That seems to be a breaking change with Angular 9.
Check this issue: https://github.com/angular/components/issues/17503
Try changing your import to use the specific components.
Example, if you are using material button then:
import { MatButtonModule } from '#angular/material/button';

issue with deploy Angular 9 SSR app to fire base

I converted my app and deployed follow the instructions here
Error with angular 9 SSR and fire base cloud functions #2369
now in the last step of deploying I get this error
Built at: 04/01/2020 4:18:16 PM
Asset Size Chunks Chunk Names
main.js 3.93 MiB 0 [emitted] [big] main
Entrypoint main [big] = main.js
chunk {0} main.js (main) 7.37 MiB [entry] [rendered]
⚠️ Your Node.js version (13.12.0) does not match the Firebase Functions runtime (10).
Deploying your Angular Universal application...
success.hosting.split is not a function
PS C:\Users\Khaled\Desktop\coupons>

Angular CLI UnhandledPromiseRejectionWarning on fresh install

I am currently trying to start a new Angular CLI (v7.1.1) project up though ng new ProjectName and it seems to work as usually. Then when i run the ng serve --open command it seems to end sucessfully, but outputs the following Warning/error:
$ ng serve --open
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2018-12-06T20:40:39.900Z
Hash: b89537a5317a31d5ae15
Time: 4712ms
chunk {main} main.js, main.js.map (main) 11.5 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 223 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 16.3 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.67 MB [initial] [rendered]
ℹ 「wdm」: Compiled successfully.
(node:3844) UnhandledPromiseRejectionWarning: Error: Exited with code 3
at ChildProcess.cp.once.code (/~path/to/project/node_modules/opn/index.js:84:13)
at Object.onceWrapper (events.js:273:13)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:978:16)
at Socket.stream.socket.on (internal/child_process.js:395:11)
at Socket.emit (events.js:182:13)
at Pipe._handle.close (net.js:616:12)
(node:3844) 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:3844) [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.
I dont know why this happens since i am using a completly fresh install without touching the code angular cli creates.
Currently running ubuntu 18.04, node v11.3.0, npm v6.4.1 and angular-cli 7.1.1 (as stated)
I have also tried to remove and install the node_modules folder but without no luck. It looks like its the OPN file that causes the problem, but i am not sure why.
Anyone else having this problem?
Based on the comment from GCSDC, i figured out the problem, or at least how not to get the error/warning. it was because i was using --open which tries to open a browser on the webpage.. but since the server the app is running on is one i connect to though ssh (and tunnels the ports) it don't make sense to use --open and then we dont have the error/warning anymore.
Apperently this warning don't show up in angular-cli 6.1.5 which the prev. project i was working on was running.
Thanks again GCSDC! :)

angular2 universal is very unstable - [nodemon] app crashed - waiting for file changes before starting

I am finding the starter repo from angular class very very unstable or just on how I am using it. My code works locally hitting the same service as remote yet I get the below
I followed the rules
npm run build
npm start
The slightest error I get the below:
'Hash: 51619e5be8128fe9ed97eb75ce5c5bacf4f02ce1
Version: webpack 2.1.0-beta.22
Child
Hash: 51619e5be8128fe9ed97
Version: webpack 2.1.0-beta.22
Time: 18736ms
Asset Size Chunks Chunk Names
index.js 3.57 MB 0 [emitted] main
[320] ./src async 160 bytes {0} [built]
+ 544 hidden modules
Child
Hash: eb75ce5c5bacf4f02ce1
Version: webpack 2.1.0-beta.22
Time: 11670ms
Asset Size Chunks Chunk Names
index.js 33.5 kB 0 [emitted] main
+ 28 hidden modules
> universal-starter#2.0.0 start /var/test-starter
> npm run server
> universal-starter#2.0.0 server /var/test-starter
> nodemon dist/server/index.js
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: /var/test-starter/dist/**/* src/index.html
[nodemon] starting `node dist/server/index.js`
Listening on: http://localhost:3000
EXCEPTION: Response with status: 200 Ok for URL: null
/var/test-starter/node_modules/zone.js/dist/zone-node.js:140
throw error;
^
Response with status: 200 Ok for URL: null
[nodemon] app crashed - waiting for file changes before starting...
How can this crash a server? I have to kill and restart.
I use angular2 n production without issue. angular2 universal is rather problematic.
How do I resolve gracefully? Or am I not serving in production properly?
The issue seems related with angular/zone.js based on your error.
Try to back to zone.js#0.6.21. If it works, try to locate the codes which cause the issue and reproduce it and post at here.
Since zone.js#0.6.22, there are some new issues, such as https://github.com/angular/zone.js/issues/448

On Windows, wepback build is blocked during 'emit' phase

I created a simple webpack project for a Typescript library : https://github.com/lbar/test-webpackts-issue
On linux, npm run build finishes successfully:
> rimraf dist && webpack --progress --profile
10% 0/1 build modulests-loader: Using typescript#1.8.10 and /tmp/testwebpack/tsconfig.json 8030ms1217ms optimi5ms emit
Hash: 8eac1502f3b7a9a19be2
Version: webpack 1.13.1
Time: 2596ms
Asset Size Chunks Chunk Names
index.js 816 bytes 0 [emitted] index
index.js.map 6.07 kB 0 [emitted] index
/tmp/testwebpack/dist/index.d.ts 31 bytes [emitted]
/tmp/testwebpack/dist/src/info.d.ts 49 bytes [emitted]
+ 2 hidden modules
On Windows, npm run build is blocked during 'emit' phase. The output is :
> rimraf dist && webpack --progress --profile
10% 0/1 build modulests-loader: Using typescript#1.8.10 and C:\tmp\testwebpack\tsconfig.jso
1836ms build modules
3ms seal
7ms optimize
3ms hashing
7ms create chunk assets
79ms additional chunk assets
19ms optimize chunk assets
837ms optimize assets
95% emit
The version of node differs: 6.2.2 on Windows and 4.4.5 on Linux. I don't know if it may be the cause.
Has anyone an idea about the problem? Issue in webpack, ts-loader or typescript?
One more thing, call to tsc is working on both systems.
Thanks for your help
This problem is caused by an issue in ts-loader: https://github.com/TypeStrong/ts-loader/issues/185
A Pull Request is waiting fixes for project core team.
Webpack can use "awesome-typescript-loader" to avoid this issue.

Resources