c# - Hur fixar jag ett rebuild TypeScript-fel @types/node


Jag har ett problem med ett lokalt repo vid återbyggnad. Jag satte upp lösningen på vår server, pushade den till Azure DevOps, drog ner den till lokal, gjorde min npm install, byggde om och får ett typescript-fel. Min kollega har inte samma problem, repot fungerar bra för henne. Jag installerade dock också samma repo på en tom laptop med samma problem som jag har.

Jag använder VS 2022 precis som på servern och alla paket och sådant är desamma.

Här är GitHub-repot jag installerade https://github.com/HBSTech/Kentico13CoreBaseline

Här är felen från utdata:

------ Rebuild All started: Project: MVC, Configuration: Debug Any CPU ------ 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(12,72): error TS1144: Build:'{' or ';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(229,72): error TS1144: Build:'{' or ';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(400,98): error TS1144: Build:'{' or ';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(400,105): error TS1005: Build:';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(400,108): error TS1005: Build:';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(432,102): error TS1144: Build:'{' or ';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(432,109): error TS1005: Build:';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(432,112): error TS1005: Build:';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(734,51): error TS1144: Build:'{' or ';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(734,57): error TS1005: Build:';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(734,60): error TS1005: Build:';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(892,65): error TS1005: Build:';' expected. 4>tsc : error TS2688: Build:Cannot find type definition file for '.vs'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\estree\index.d.ts(107,38): error TS2304: Build:Cannot find name 'Omit'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\estree\index.d.ts(400,11): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(12,64): error TS2304: Build:Cannot find name 'asserts'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(12,72): error TS1144: Build:'{' or ';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(12,72): error TS2304: Build:Cannot find name 'value'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(229,64): error TS2304: Build:Cannot find name 'asserts'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(229,72): error TS1144: Build:'{' or ';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(229,72): error TS2304: Build:Cannot find name 'value'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(400,90): error TS2304: Build:Cannot find name 'asserts'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(400,98): error TS1144: Build:'{' or ';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(400,98): error TS2304: Build:Cannot find name 'actual'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(400,105): error TS1005: Build:';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(400,105): error TS2304: Build:Cannot find name 'is'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(400,108): error TS1005: Build:';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(400,108): error TS2304: Build:Cannot find name 'T'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(432,94): error TS2304: Build:Cannot find name 'asserts'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(432,102): error TS1144: Build:'{' or ';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(432,102): error TS2304: Build:Cannot find name 'actual'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(432,109): error TS1005: Build:';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(432,109): error TS2304: Build:Cannot find name 'is'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(432,112): error TS1005: Build:';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(432,112): error TS2304: Build:Cannot find name 'T'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(734,43): error TS2304: Build:Cannot find name 'asserts'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(734,51): error TS1144: Build:'{' or ';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(734,51): error TS2304: Build:Cannot find name 'value'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(734,57): error TS1005: Build:';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(734,57): error TS2304: Build:Cannot find name 'is'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(734,60): error TS1005: Build:';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(734,60): error TS2531: Build:Object is possibly 'null'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(734,67): error TS2532: Build:Object is possibly 'undefined'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(891,23): error TS2304: Build:Cannot find name 'Omit'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(892,57): error TS2304: Build:Cannot find name 'asserts'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\assert.d.ts(892,65): error TS1005: Build:';' expected. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(166,26): error TS2304: Build:Cannot find name 'globalThis'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(166,26): error TS2503: Build:Cannot find namespace 'globalThis'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(167,26): error TS2304: Build:Cannot find name 'globalThis'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(167,26): error TS2503: Build:Cannot find namespace 'globalThis'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(212,45): error TS2304: Build:Cannot find name 'SharedArrayBuffer'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(244,66): error TS2304: Build:Cannot find name 'SharedArrayBuffer'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(336,80): error TS2304: Build:Cannot find name 'SharedArrayBuffer'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(869,36): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(890,36): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(911,37): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(916,37): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(937,37): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(942,37): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(1057,47): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(1062,47): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(1079,47): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(1084,47): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(1093,46): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\buffer.d.ts(1102,46): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\child_process.d.ts(71,62): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\console.d.ts(411,14): error TS2304: Build:Cannot find name 'globalThis'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\crypto.d.ts(510,26): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\crypto.d.ts(3229,53): error TS2304: Build:Cannot find name 'SharedArrayBuffer'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\crypto.d.ts(3229,87): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\crypto.d.ts(3273,116): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\crypto.d.ts(3275,124): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\crypto.d.ts(3304,84): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\crypto.d.ts(3306,92): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\fs.d.ts(2235,41): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\fs.d.ts(3790,52): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\fs.d.ts(3791,18): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\fs.d.ts(3792,18): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\fs.d.ts(3793,18): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\fs.d.ts(3794,22): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\globals.d.ts(99,51): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\globals.d.ts(100,52): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\globals.global.d.ts(1,28): error TS2304: Build:Cannot find name 'globalThis'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\index.d.ts(72,21): error TS2726: Build:Cannot find lib definition for 'es2020'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\index.d.ts(75,21): error TS2727: Build:Cannot find lib definition for 'esnext.bigint'. Did you mean 'esnext.intl'? 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\perf_hooks.d.ts(493,30): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\perf_hooks.d.ts(537,24): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\perf_hooks.d.ts(542,24): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\process.d.ts(119,27): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\stream.d.ts(842,106): error TS2304: Build:Cannot find name 'AsyncGeneratorFunction'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\url.d.ts(872,13): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'URL' must be of type '{ new (url: string, base?: string | URL | undefined): URL; prototype: URL; createObjectURL(object: any): string; revokeObjectURL(url: string): void; }', but here has type '{} | typeof URL'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\url.d.ts(874,20): error TS2304: Build:Cannot find name 'globalThis'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\url.d.ts(882,13): error TS2403: Build:Subsequent variable declarations must have the same type. Variable 'URLSearchParams' must be of type '{ new (init?: string | Record<string, string> | URLSearchParams | string[][] | undefined): URLSearchParams; prototype: URLSearchParams; }', but here has type '{} | typeof URLSearchParams'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\url.d.ts(884,20): error TS2304: Build:Cannot find name 'globalThis'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\util.d.ts(1216,77): error TS2304: Build:Cannot find name 'BigInt'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\util.d.ts(1479,62): error TS2304: Build:Cannot find name 'SharedArrayBuffer'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\node\worker_threads.d.ts(610,62): error TS2304: Build:Cannot find name 'bigint'. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\react\index.d.ts(232,10): error TS2456: Build:Type alias 'ReactFragment' circularly references itself. 4>C:\VS_2022_REPOS\REPO\EmployeePortal\MVCBaseline\MVC\MVC\node_modules@types\react\index.d.ts(233,10): error TS2456: Build:Type alias 'ReactNode' circularly references itself. 4>Done building project "MVC.csproj" -- FAILED.

========== Rebuild All: 3 succeeded, 1 failed, 0 skipped ==========

Vad jag har försökt: Jag såg till att TypeScript-versionen och @types/node-versionen var kompatibla enligt detta. Jag får ett FEL när jag kompilerar Angular 6-projektet

Jag har försökt uppgradera, nedgradera och alla möjliga andra kombinationer för TS och node. Jag har också säkerställt att VS 2022 är uppdaterat samt Windows. Jag har kopierat det exakta, fungerande repot från servern direkt till min lokala maskin, byggt om och fick samma fel. Jag är säker på att det finns fler saker jag för närvarande inte kan komma på.

Slutligen bör det noteras att detta är min första erfarenhet med TS och dessa typer av fel, så förlåt mig om det finns några dumma frågor eller antaganden från min sida. Tack.

Svar #1

Efter många huvudvärkande timmar hittade jag denna varning (borde nog ha börjat där), men nu verkar allt fungera bra efter att ha installerat det nämnda paketet. Märkligt nog var detta inte nödvändigt vid den ursprungliga installationen.

Svar #2

Du kan prova detta:

  1. Radera din package-lock.json-fil.
  2. Radera node_modules-mappen.

Kör sedan npm i --force

Relaterade artiklar