Skip to content

problem running "npm run server" #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
davoutuk opened this issue Jan 1, 2021 · 4 comments
Open

problem running "npm run server" #8

davoutuk opened this issue Jan 1, 2021 · 4 comments

Comments

@davoutuk
Copy link

davoutuk commented Jan 1, 2021

I have just started the course, and when I try to run the command "npm run server", I get the following error...

D:\Ian\Documents\coding\angular\reactive-angular-course>npm run server

reactive-angular-course@0.0.0 server D:\Ian\Documents\coding\angular\reactive-angular-course
ts-node -P ./server/server.tsconfig.json ./server/server.ts

D:\Ian\Documents\coding\angular\reactive-angular-course\node_modules\ts-node\src\index.ts:307
throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset))
^
TSError: ⨯ Unable to compile TypeScript
server\search-lessons.route.ts (17,33): Argument of type 'string | ParsedQs | string[] | ParsedQs[]' is not assignable to parameter of type 'string'.
Type 'ParsedQs' is not assignable to type 'string'. (2345)
server\search-lessons.route.ts (18,31): Argument of type 'string | ParsedQs | string[] | ParsedQs[]' is not assignable to parameter of type 'string'.
Type 'ParsedQs' is not assignable to type 'string'. (2345)
server\search-lessons.route.ts (23,59): This condition will always return 'false' since the types 'number' and 'string | ParsedQs | string[] | ParsedQs[]' have no overlap. (2367)
server\search-lessons.route.ts (30,97): Property 'toLowerCase' does not exist on type 'string | ParsedQs | string[] | ParsedQs[]'.
Property 'toLowerCase' does not exist on type 'string[]'. (2339)
at getOutput (D:\Ian\Documents\coding\angular\reactive-angular-course\node_modules\ts-node\src\index.ts:307:15)
at D:\Ian\Documents\coding\angular\reactive-angular-course\node_modules\ts-node\src\index.ts:336:16
at Object.compile (D:\Ian\Documents\coding\angular\reactive-angular-course\node_modules\ts-node\src\index.ts:496:11)
at Module.m._compile (D:\Ian\Documents\coding\angular\reactive-angular-course\node_modules\ts-node\src\index.ts:392:43)
at Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Object.require.extensions.(anonymous function) [as .ts] (D:\Ian\Documents\coding\angular\reactive-angular-course\node_modules\ts-node\src\index.ts:395:12)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)

npm ERR! Windows_NT 10.0.19041
npm ERR! argv "D:\Program Files\nodejs\node.exe" "C:\Users\Ian\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "server"
npm ERR! node v10.16.0
npm ERR! npm v4.0.2
npm ERR! code ELIFECYCLE
npm ERR! reactive-angular-course@0.0.0 server: ts-node -P ./server/server.tsconfig.json ./server/server.ts
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactive-angular-course@0.0.0 server script 'ts-node -P ./server/server.tsconfig.json ./server/server.ts'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the reactive-angular-course package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ts-node -P ./server/server.tsconfig.json ./server/server.ts
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs reactive-angular-course
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls reactive-angular-course
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! D:\Ian\Documents\coding\angular\reactive-angular-course\npm-debug.log

@Elmar101
Copy link

too me

@theobroma
Copy link

theobroma commented Jan 23, 2021

Try to fix TS errors. Here is my quick solution:
// file 'search-lessons.route.ts'

  1. Add "as string"
    const courseId = queryParams.courseId, filter = (queryParams.filter || '') as string, sortOrder = queryParams.sortOrder || 'asc', pageNumber = parseInt(queryParams.pageNumber as string) || 0, pageSize = parseInt(queryParams.pageSize as string) || 3;
  2. Wrap with "Number"
    let lessons; if (courseId) { lessons = Object.values(LESSONS).filter(lesson => Number(lesson.courseId) === Number(courseId)).sort((l1, l2) => l1.id - l2.id); }
    P.S. Before I got this errors, I had to update ts-node to latest 9.1.1

@gauravgusa
Copy link

If you have multiple version of npm; install nvm and use nvm to switch to required version.

on windows install wsl ;
install nodejs on windows ubuntu
then install nvm
nvm use 14.15.0

With above you should be able to proceed.

@mkanyar
Copy link

mkanyar commented Apr 27, 2022

I have just started the course, and when I try to run the command "npm run server", I get the following error...

D:\Ian\Documents\coding\angular\reactive-angular-course>npm run server

reactive-angular-course@0.0.0 server D:\Ian\Documents\coding\angular\reactive-angular-course
ts-node -P ./server/server.tsconfig.json ./server/server.ts

D:\Ian\Documents\coding\angular\reactive-angular-course\node_modules\ts-node\src\index.ts:307 throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset)) ^ TSError: ⨯ Unable to compile TypeScript server\search-lessons.route.ts (17,33): Argument of type 'string | ParsedQs | string[] | ParsedQs[]' is not assignable to parameter of type 'string'. Type 'ParsedQs' is not assignable to type 'string'. (2345) server\search-lessons.route.ts (18,31): Argument of type 'string | ParsedQs | string[] | ParsedQs[]' is not assignable to parameter of type 'string'. Type 'ParsedQs' is not assignable to type 'string'. (2345) server\search-lessons.route.ts (23,59): This condition will always return 'false' since the types 'number' and 'string | ParsedQs | string[] | ParsedQs[]' have no overlap. (2367) server\search-lessons.route.ts (30,97): Property 'toLowerCase' does not exist on type 'string | ParsedQs | string[] | ParsedQs[]'. Property 'toLowerCase' does not exist on type 'string[]'. (2339) at getOutput (D:\Ian\Documents\coding\angular\reactive-angular-course\node_modules\ts-node\src\index.ts:307:15) at D:\Ian\Documents\coding\angular\reactive-angular-course\node_modules\ts-node\src\index.ts:336:16 at Object.compile (D:\Ian\Documents\coding\angular\reactive-angular-course\node_modules\ts-node\src\index.ts:496:11) at Module.m._compile (D:\Ian\Documents\coding\angular\reactive-angular-course\node_modules\ts-node\src\index.ts:392:43) at Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Object.require.extensions.(anonymous function) [as .ts] (D:\Ian\Documents\coding\angular\reactive-angular-course\node_modules\ts-node\src\index.ts:395:12) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:690:17)

npm ERR! Windows_NT 10.0.19041 npm ERR! argv "D:\Program Files\nodejs\node.exe" "C:\Users\Ian\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "server" npm ERR! node v10.16.0 npm ERR! npm v4.0.2 npm ERR! code ELIFECYCLE npm ERR! reactive-angular-course@0.0.0 server: ts-node -P ./server/server.tsconfig.json ./server/server.ts npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the reactive-angular-course@0.0.0 server script 'ts-node -P ./server/server.tsconfig.json ./server/server.ts'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the reactive-angular-course package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! ts-node -P ./server/server.tsconfig.json ./server/server.ts npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs reactive-angular-course npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls reactive-angular-course npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! D:\Ian\Documents\coding\angular\reactive-angular-course\npm-debug.log

This fixed it for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants