question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build failed using npm run build on typescript projects

See original GitHub issue

Describe 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:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
darrachequesnecommented, Apr 23, 2021

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)

1reaction
ithustlecommented, Feb 5, 2022

@darrachequesne I’m facing the same issue. I’m using typescript version 4.5.5

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found