Build failed using npm run build on typescript projects
See original GitHub issueDescribe the bug
I have a backend with express and typescript that use npm as a package manager and I run the next command to build the project npm run build
that command run the next script tsc -p .
to build the project.
But I have the next errors
node_modules/socket.io/dist/broadcast-operator.d.ts:1:13 - error TS1005: '=' expected.
1 import type { BroadcastFlags, Room, SocketId } from "socket.io-adapter";
~
node_modules/socket.io/dist/broadcast-operator.d.ts:1:53 - error TS1005: ';' expected.
1 import type { BroadcastFlags, Room, SocketId } from "socket.io-adapter";
~~~~~~~~~~~~~~~~~~~
node_modules/socket.io/dist/broadcast-operator.d.ts:3:13 - error TS1005: '=' expected.
3 import type { Adapter } from "socket.io-adapter";
~
node_modules/socket.io/dist/broadcast-operator.d.ts:3:30 - error TS1005: ';' expected.
3 import type { Adapter } from "socket.io-adapter";
~~~~~~~~~~~~~~~~~~~
node_modules/socket.io/dist/broadcast-operator.d.ts:4:13 - error TS1005: '=' expected.
4 import type { EventParams, EventNames, EventsMap, TypedEventBroadcaster } from "./typed-events";
~
node_modules/socket.io/dist/broadcast-operator.d.ts:4:80 - error TS1005: ';' expected.
4 import type { EventParams, EventNames, EventsMap, TypedEventBroadcaster } from "./typed-events";
~~~~~~~~~~~~~~~~
node_modules/socket.io/dist/index.d.ts:6:13 - error TS1005: '=' expected.
6 import type { Encoder } from "socket.io-parser";
~
node_modules/socket.io/dist/index.d.ts:6:30 - error TS1005: ';' expected.
6 import type { Encoder } from "socket.io-parser";
~~~~~~~~~~~~~~~~~~
node_modules/socket.io/dist/index.d.ts:8:13 - error TS1005: '=' expected.
8 import type { CookieSerializeOptions } from "cookie";
~
node_modules/socket.io/dist/index.d.ts:8:45 - error TS1005: ';' expected.
8 import type { CookieSerializeOptions } from "cookie";
~~~~~~~~
node_modules/socket.io/dist/index.d.ts:9:13 - error TS1005: '=' expected.
9 import type { CorsOptions } from "cors";
~
node_modules/socket.io/dist/index.d.ts:9:34 - error TS1005: ';' expected.
9 import type { CorsOptions } from "cors";
~~~~~~
node_modules/socket.io/dist/index.d.ts:10:13 - error TS1005: '=' expected.
10 import type { BroadcastOperator, RemoteSocket } from "./broadcast-operator";
~
node_modules/socket.io/dist/index.d.ts:10:54 - error TS1005: ';' expected.
10 import type { BroadcastOperator, RemoteSocket } from "./broadcast-operator";
~~~~~~~~~~~~~~~~~~~~~~
node_modules/socket.io/dist/namespace.d.ts:2:13 - error TS1005: '=' expected.
2 import type { Server } from "./index";
~
node_modules/socket.io/dist/namespace.d.ts:2:29 - error TS1005: ';' expected.
2 import type { Server } from "./index";
~~~~~~~~~
node_modules/socket.io/dist/namespace.d.ts:4:13 - error TS1005: '=' expected.
4 import type { Client } from "./client";
~
node_modules/socket.io/dist/namespace.d.ts:4:29 - error TS1005: ';' expected.
4 import type { Client } from "./client";
~~~~~~~~~~
node_modules/socket.io/dist/namespace.d.ts:5:13 - error TS1005: '=' expected.
5 import type { Adapter, Room, SocketId } from "socket.io-adapter";
~
node_modules/socket.io/dist/namespace.d.ts:5:46 - error TS1005: ';' expected.
5 import type { Adapter, Room, SocketId } from "socket.io-adapter";
~~~~~~~~~~~~~~~~~~~
node_modules/socket.io/dist/socket.d.ts:4:13 - error TS1005: '=' expected.
4 import type { Client } from "./client";
~
node_modules/socket.io/dist/socket.d.ts:4:29 - error TS1005: ';' expected.
4 import type { Client } from "./client";
~~~~~~~~~~
node_modules/socket.io/dist/socket.d.ts:5:13 - error TS1005: '=' expected.
5 import type { Namespace } from "./namespace";
~
node_modules/socket.io/dist/socket.d.ts:5:32 - error TS1005: ';' expected.
5 import type { Namespace } from "./namespace";
~~~~~~~~~~~~~
node_modules/socket.io/dist/socket.d.ts:6:13 - error TS1005: '=' expected.
6 import type { IncomingMessage, IncomingHttpHeaders } from "http";
~
node_modules/socket.io/dist/socket.d.ts:6:59 - error TS1005: ';' expected.
6 import type { IncomingMessage, IncomingHttpHeaders } from "http";
~~~~~~
node_modules/socket.io/dist/socket.d.ts:7:13 - error TS1005: '=' expected.
7 import type { Room, SocketId } from "socket.io-adapter";
~
node_modules/socket.io/dist/socket.d.ts:7:37 - error TS1005: ';' expected.
7 import type { Room, SocketId } from "socket.io-adapter";
~~~~~~~~~~~~~~~~~~~
node_modules/socket.io/dist/socket.d.ts:8:13 - error TS1005: '=' expected.
8 import type { ParsedUrlQuery } from "querystring";
~
node_modules/socket.io/dist/socket.d.ts:8:37 - error TS1005: ';' expected.
8 import type { ParsedUrlQuery } from "querystring";
Versions used
"socket.io": "^4.0.1",
"socket.io-redis": "^6.1.0",
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
npm run build produces a Type Error with no indication to ...
I am not using .toLowerCase across my project npm start runs fine, So only the optimized build process is facing this problem.
Read more >Documentation - Integrating with Build Tools - TypeScript
Right-Click -> Manage NuGet Packages · Search for Microsoft.TypeScript.MSBuild · Hit Install · When install is complete, rebuild!
Read more >ts-node - npm
This error is thrown by node when a module is require() d, but node believes it should execute as native ESM. This can...
Read more >TypeScript Compiling with Visual Studio Code
Under the covers, we run the TypeScript compiler as a task. The command we use is: tsc -p . Step 3: Make the...
Read more >Tried to deploy app on React + Typescript. Can't see exact ...
Hi everyone! Can't understand why webstite do not want to deploy normally with npm run build command. I used React, React bootstrap and ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi! That’s a good point, I think we should add this somewhere in the documentation 👍 (
import type
syntax was added in TypeScript 3.8)@darrachequesne I’m facing the same issue. I’m using
typescript version 4.5.5