NoahCardoza / CloudProxy

Proxy server to bypass Cloudflare protection.
MIT License
538 stars 62 forks source link

Compile Error #79

Open LoboMetalurgico opened 1 year ago

LoboMetalurgico commented 1 year ago

Describe the bug When I run npm run build the compiler throw an error.

Using npm@8.19.3 and node@16.19.0

To Reproduce Clone the repository Install using PUPPETEER_PRODUCT=chrome npm install Run npm run build

Expected behavior Project compile

Desktop (please complete the following information):

Additional context Log:

> cloud-proxy@2.1.1 build
> tsc

node_modules/got/dist/source/core/index.d.ts:12:15 - error TS1005: ',' expected.

12 import { type PlainResponse, type Response } from './response.js';
                 ~~~~~~~~~~~~~

node_modules/got/dist/source/core/index.d.ts:12:35 - error TS1005: ',' expected.

12 import { type PlainResponse, type Response } from './response.js';
                                     ~~~~~~~~

node_modules/got/dist/source/core/options.d.ts:21:29 - error TS1005: ',' expected.

21 import http2wrapper, { type ClientHttp2Session } from 'http2-wrapper';
                               ~~~~~~~~~~~~~~~~~~

Found 3 errors.
dpapka-giosg commented 1 year ago

Hello! Having the same problem. For everybody who is searching the solution.

First, right now package.json contains typescript dependency of version 3.9.7 and one of the project dependencies requires Typescript 4.5+.

This is because import type syntax was introduced in TS 3.8:

import type { SomeThing } from "....";

However, type modifiers on import names were introduced in TS 4.5:

import { someFunc, type BaseType } from ".....";

So the first thing you need to do is updating your Typescript version:

npm install --save-dev typescript@4.5

Then a couple of other errors will appear, like:

node_modules/cacheable-request/dist/types.d.ts:5:72 - error TS2307: Cannot find module 'node:http' or its corresponding type declarations.
5 import { request, RequestOptions, ClientRequest, ServerResponse } from 'node:http';

Update yours @types/node:

npm install --save-dev @types/node@latest

After this you can build the project without errors. @LoboMetalurgico