Redocly / redoc

📘 OpenAPI/Swagger-generated API Reference Documentation
https://redocly.github.io/redoc/
MIT License
23.55k stars 2.3k forks source link

Can't build on windows 10 #2229

Open clabnet opened 1 year ago

clabnet commented 1 year ago

Describe the bug Cannot build on windows 10 system

Expected behavior A running local version

System: OS: Windows 10 10.0.19044 CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz Memory: 4.51 GB / 15.86 GB Binaries: Node: 16.14.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD npm: 8.5.1 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.19041.1266.0), Chromium (108.0.1462.42) Internet Explorer: 11.0.19041.1566

Additional context

ERROR in ./src/utils/helpers.ts 137:15-35

Module not found: Error: Can't resolve 'url' in 'D:\Weblabs\nodejs\redoc\src\utils'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

ERROR in ./src/utils/helpers.ts 137:15-35

Module not found: Error: Can't resolve 'url' in 'D:\Weblabs\nodejs\redoc\src\utils'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

ERROR in cli/index.ts:4:33

TS2307: Cannot find module 'update-notifier' or its corresponding type declarations. 2 | / tslint:disable:no-implicit-dependencies / 3 | import * as React from 'react';

4 | import * as updateNotifier from 'update-notifier'; | ^^^^^^^^^^^^^^^^^ 5 | import { renderToString } from 'react-dom/server'; 6 | import { ServerStyleSheet } from 'styled-components'; 7 |

ERROR in cli/index.ts:8:25

TS2307: Cannot find module 'handlebars' or its corresponding type declarations. 6 | import { ServerStyleSheet } from 'styled-components'; 7 |

8 | import { compile } from 'handlebars'; | ^^^^^^^^^^^^ 9 | import { createServer, IncomingMessage, ServerResponse } from 'http'; 10 | import { dirname, join, resolve, extname as getExtName } from 'path'; 11 |

ERROR in cli/index.ts:17:23

TS2307: Cannot find module 'chokidar' or its corresponding type declarations. 15 | import { createStore, loadAndBundleSpec, Redoc } from 'redoc'; 16 |

17 | import { watch } from 'chokidar'; | ^^^^^^^^^^ 18 | import { 19 | createReadStream, 20 | existsSync,

ERROR in cli/index.ts:26:25

TS2307: Cannot find module 'mkdirp' or its corresponding type declarations. 24 | writeFileSync, 25 | } from 'fs';

26 | import as mkdirp from 'mkdirp'; | ^^^^^^^^ 27 | 28 | import as YargsParser from 'yargs'; 29 | // eslint-disable-next-line import/no-extraneous-dependencies

ERROR in cli/index.ts:122:1

TS2769: No overload matches this call. Overload 1 of 7, '(command: string | readonly string[], showInHelp: false, builder?: ((args: Argv<{}>) => void) | ((args: Argv<{}>) => PromiseLike<Argv<{}>>) | ((args: Argv<{}>) => Argv<...>) | undefined, handler?: ((args: ArgumentsCamelCase<...>) => void | Promise<...>) | undefined, middlewares?: MiddlewareFunction<...>[] | undefined, deprecated?: string | ... 1 more ... | undefined): Argv<...>', gave the following error. Argument of type '"start the server"' is not assignable to parameter of type 'false'. Overload 2 of 7, '(command: string | readonly string[], description: string, builder?: ((args: Argv<{}>) => void) | ((args: Argv<{}>) => PromiseLike<Argv<{}>>) | ((args: Argv<{}>) => Argv<...>) | undefined, handler?: ((args: ArgumentsCamelCase<...>) => void | Promise<...>) | undefined, middlewares?: MiddlewareFunction<...>[] | undefined, deprecated?: string | ... 1 more ... | undefined): Argv<...>', gave the following error. Type '(res: { [argName: string]: unknown; : (string | number)[]; $0: string; }) => { [argName: string]: unknown; : (string | number)[]; $0: string; }' is not assignable to type 'MiddlewareFunction<{}>'. Type '{ [argName: string]: unknown; : (string | number)[]; $0: string; }' is not assignable to type 'void | Promise'. Type '{ [argName: string]: unknown; : (string | number)[]; $0: string; }' is missing the following properties from type 'Promise': then, catch, [Symbol.toStringTag], finally Overload 3 of 7, '(command: string | readonly string[], description: string, builder?: { [key: string]: Options; } | undefined, handler?: ((args: ArgumentsCamelCase<InferredOptionTypes<{ [key: string]: Options; }>>) => void | Promise<...>) | undefined, middlewares?: MiddlewareFunction<...>[] | undefined, deprecated?: string | ... 1 more ... | undefined): Argv<...>', gave the following error. Argument of type '(yargs: Argv<{}>) => Argv<{}>' is not assignable to parameter of type '{ [key: string]: Options; }'. Index signature is missing in type '(yargs: Argv<{}>) => Argv<{}>'. 120 | }; 121 |

122 | YargsParser.command( | ^^^^^^^^^^^^^^^^^^^^ 123 | 'serve ', | ^^^^^^^^^^^^^^^^^ 124 | 'start the server', | ^^^^^^^^^^^^^^^^^ 125 | yargs => { | ^^^^^^^^^^^^^^^^^ 126 | yargs.positional('spec', { | ^^^^^^^^^^^^^^^^^ 127 | describe: 'path or URL to your spec', | ^^^^^^^^^^^^^^^^^ 128 | }); | ^^^^^^^^^^^^^^^^^ 129 | | ^^^^^^^^^^^^^^^^^ 130 | yargs.options('title', { | ^^^^^^^^^^^^^^^^^ 131 | describe: 'Page Title', | ^^^^^^^^^^^^^^^^^ 132 | type: 'string', | ^^^^^^^^^^^^^^^^^ 133 | }); | ^^^^^^^^^^^^^^^^^ 134 | | ^^^^^^^^^^^^^^^^^ 135 | yargs.option('s', { | ^^^^^^^^^^^^^^^^^ 136 | alias: 'ssr', | ^^^^^^^^^^^^^^^^^ 137 | describe: 'Enable server-side rendering', | ^^^^^^^^^^^^^^^^^ 138 | type: 'boolean', | ^^^^^^^^^^^^^^^^^ 139 | }); | ^^^^^^^^^^^^^^^^^ 140 | | ^^^^^^^^^^^^^^^^^ 141 | yargs.option('h', { | ^^^^^^^^^^^^^^^^^ 142 | alias: 'host', | ^^^^^^^^^^^^^^^^^ 143 | type: 'string', | ^^^^^^^^^^^^^^^^^ 144 | default: '127.0.0.1', | ^^^^^^^^^^^^^^^^^ 145 | }); | ^^^^^^^^^^^^^^^^^ 146 | | ^^^^^^^^^^^^^^^^^ 147 | yargs.option('p', { | ^^^^^^^^^^^^^^^^^ 148 | alias: 'port', | ^^^^^^^^^^^^^^^^^ 149 | type: 'number', | ^^^^^^^^^^^^^^^^^ 150 | default: 8080, | ^^^^^^^^^^^^^^^^^ 151 | }); | ^^^^^^^^^^^^^^^^^ 152 | | ^^^^^^^^^^^^^^^^^ 153 | yargs.option('w', { | ^^^^^^^^^^^^^^^^^ 154 | alias: 'watch', | ^^^^^^^^^^^^^^^^^ 155 | type: 'boolean', | ^^^^^^^^^^^^^^^^^ 156 | }); | ^^^^^^^^^^^^^^^^^ 157 | | ^^^^^^^^^^^^^^^^^ 158 | yargs.options('disable-google-font', { | ^^^^^^^^^^^^^^^^^ 159 | describe: 'Disable Google Font', | ^^^^^^^^^^^^^^^^^ 160 | type: 'boolean', | ^^^^^^^^^^^^^^^^^ 161 | default: false, | ^^^^^^^^^^^^^^^^^ 162 | }); | ^^^^^^^^^^^^^^^^^ 163 | | ^^^^^^^^^^^^^^^^^ 164 | yargs.demandOption('spec'); | ^^^^^^^^^^^^^^^^^ 165 | return yargs; | ^^^^^^^^^^^^^^^^^ 166 | }, | ^^^^^^^^^^^^^^^^^ 167 | async argv => { | ^^^^^^^^^^^^^^^^^ 168 | const config: Options = { | ^^^^^^^^^^^^^^^^^ 169 | ssr: argv.ssr as boolean, | ^^^^^^^^^^^^^^^^^ 170 | title: argv.title as string, | ^^^^^^^^^^^^^^^^^ 171 | watch: argv.watch as boolean, | ^^^^^^^^^^^^^^^^^ 172 | disableGoogleFont: argv.disableGoogleFont as boolean, | ^^^^^^^^^^^^^^^^^ 173 | templateFileName: argv.template as string, | ^^^^^^^^^^^^^^^^^ 174 | templateOptions: argv.templateOptions || {}, | ^^^^^^^^^^^^^^^^^ 175 | redocOptions: getObjectOrJSON(argv.options), | ^^^^^^^^^^^^^^^^^ 176 | }; | ^^^^^^^^^^^^^^^^^ 177 | | ^^^^^^^^^^^^^^^^^ 178 | try { | ^^^^^^^^^^^^^^^^^ 179 | notifyUpdateCliVersion(); | ^^^^^^^^^^^^^^^^^ 180 | await serve(argv.host as string, argv.port as number, argv.spec as string, config); | ^^^^^^^^^^^^^^^^^ 181 | } catch (e) { | ^^^^^^^^^^^^^^^^^ 182 | handleError(e); | ^^^^^^^^^^^^^^^^^ 183 | } | ^^^^^^^^^^^^^^^^^ 184 | }, | ^^^^^^^^^^^^^^^^^ 185 | [ | ^^^^^^^^^^^^^^^^^ 186 | res => { | ^^^^^^^^^^^^^^^^^ 187 | console.log( | ^^^^^^^^^^^^^^^^^ 188 | \n⚠️ This command is deprecated. Use "npx @redocly/cli preview-docs petstore.yaml"\n, | ^^^^^^^^^^^^^^^^^ 189 | ); | ^^^^^^^^^^^^^^^^^ 190 | return res; | ^^^^^^^^^^^^^^^^^ 191 | }, | ^^^^^^^^^^^^^^^^^ 192 | ], | ^^^^^^^^^^^^^^^^^ 193 | ) | ^^ 194 | .command( 195 | 'build ', 196 | 'build definition into zero-dependency HTML-file',

ERROR in cli/index.ts:122:1

TS2769: No overload matches this call. Overload 1 of 7, '(command: string | readonly string[], showInHelp: false, builder?: ((args: Argv<{}>) => void) | ((args: Argv<{}>) => PromiseLike<Argv<{}>>) | ((args: Argv<{}>) => Argv<...>) | undefined, handler?: ((args: ArgumentsCamelCase<...>) => void | Promise<...>) | undefined, middlewares?: MiddlewareFunction<...>[] | undefined, deprecated?: string | ... 1 more ... | undefined): Argv<...>', gave the following error. Argument of type '"bundle spec into zero-dependency HTML-file [deprecated]"' is not assignable to parameter of type 'false'. Overload 2 of 7, '(command: string | readonly string[], description: string, builder?: ((args: Argv<{}>) => void) | ((args: Argv<{}>) => PromiseLike<Argv<{}>>) | ((args: Argv<{}>) => Argv<...>) | undefined, handler?: ((args: ArgumentsCamelCase<...>) => void | Promise<...>) | undefined, middlewares?: MiddlewareFunction<...>[] | undefined, deprecated?: string | ... 1 more ... | undefined): Argv<...>', gave the following error. Type '(res: { [argName: string]: unknown; : (string | number)[]; $0: string; }) => { [argName: string]: unknown; : (string | number)[]; $0: string; }' is not assignable to type 'MiddlewareFunction<{}>'. Type '{ [argName: string]: unknown; : (string | number)[]; $0: string; }' is not assignable to type 'void | Promise'. Type '{ [argName: string]: unknown; : (string | number)[]; $0: string; }' is not assignable to type 'Promise'. Overload 3 of 7, '(command: string | readonly string[], description: string, builder?: { [key: string]: Options; } | undefined, handler?: ((args: ArgumentsCamelCase<InferredOptionTypes<{ [key: string]: Options; }>>) => void | Promise<...>) | undefined, middlewares?: MiddlewareFunction<...>[] | undefined, deprecated?: string | ... 1 more ... | undefined): Argv<...>', gave the following error. Argument of type '(yargs: any) => any' is not assignable to parameter of type '{ [key: string]: Options; }'. Index signature is missing in type '(yargs: any) => any'. 120 | }; 121 |

122 | YargsParser.command( | ^^^^^^^^^^^^^^^^^^^^ 123 | 'serve ', | ^^^^^^^^^^^^^^^^^ 124 | 'start the server', | ^^^^^^^^^^^^^^^^^ 125 | yargs => { | ^^^^^^^^^^^^^^^^^ 126 | yargs.positional('spec', { | ^^^^^^^^^^^^^^^^^ 127 | describe: 'path or URL to your spec', | ^^^^^^^^^^^^^^^^^ 128 | }); | ^^^^^^^^^^^^^^^^^ 129 | | ^^^^^^^^^^^^^^^^^ 130 | yargs.options('title', { | ^^^^^^^^^^^^^^^^^ 131 | describe: 'Page Title', | ^^^^^^^^^^^^^^^^^ 132 | type: 'string', | ^^^^^^^^^^^^^^^^^ 133 | }); | ^^^^^^^^^^^^^^^^^ 134 | | ^^^^^^^^^^^^^^^^^ 135 | yargs.option('s', { | ^^^^^^^^^^^^^^^^^ 136 | alias: 'ssr', | ^^^^^^^^^^^^^^^^^ 137 | describe: 'Enable server-side rendering', | ^^^^^^^^^^^^^^^^^ 138 | type: 'boolean', | ^^^^^^^^^^^^^^^^^ 139 | }); | ^^^^^^^^^^^^^^^^^ 140 | | ^^^^^^^^^^^^^^^^^ 141 | yargs.option('h', { | ^^^^^^^^^^^^^^^^^ 142 | alias: 'host', | ^^^^^^^^^^^^^^^^^ 143 | type: 'string', | ^^^^^^^^^^^^^^^^^ 144 | default: '127.0.0.1', | ^^^^^^^^^^^^^^^^^ 145 | }); | ^^^^^^^^^^^^^^^^^ 146 | | ^^^^^^^^^^^^^^^^^ 147 | yargs.option('p', { | ^^^^^^^^^^^^^^^^^ 148 | alias: 'port', | ^^^^^^^^^^^^^^^^^ 149 | type: 'number', | ^^^^^^^^^^^^^^^^^ 150 | default: 8080, | ^^^^^^^^^^^^^^^^^ 151 | }); | ^^^^^^^^^^^^^^^^^ 152 | | ^^^^^^^^^^^^^^^^^ 153 | yargs.option('w', { | ^^^^^^^^^^^^^^^^^ 154 | alias: 'watch', | ^^^^^^^^^^^^^^^^^ 155 | type: 'boolean', | ^^^^^^^^^^^^^^^^^ 156 | }); | ^^^^^^^^^^^^^^^^^ 157 | | ^^^^^^^^^^^^^^^^^ 158 | yargs.options('disable-google-font', { | ^^^^^^^^^^^^^^^^^ 159 | describe: 'Disable Google Font', | ^^^^^^^^^^^^^^^^^ 160 | type: 'boolean', | ^^^^^^^^^^^^^^^^^ 161 | default: false, | ^^^^^^^^^^^^^^^^^ 162 | }); | ^^^^^^^^^^^^^^^^^ 163 | | ^^^^^^^^^^^^^^^^^ 164 | yargs.demandOption('spec'); | ^^^^^^^^^^^^^^^^^ 165 | return yargs; | ^^^^^^^^^^^^^^^^^ 166 | }, | ^^^^^^^^^^^^^^^^^ 167 | async argv => { | ^^^^^^^^^^^^^^^^^ 168 | const config: Options = { | ^^^^^^^^^^^^^^^^^ 169 | ssr: argv.ssr as boolean, | ^^^^^^^^^^^^^^^^^ 170 | title: argv.title as string, | ^^^^^^^^^^^^^^^^^ 171 | watch: argv.watch as boolean, | ^^^^^^^^^^^^^^^^^ 172 | disableGoogleFont: argv.disableGoogleFont as boolean, | ^^^^^^^^^^^^^^^^^ 173 | templateFileName: argv.template as string, | ^^^^^^^^^^^^^^^^^ 174 | templateOptions: argv.templateOptions || {}, | ^^^^^^^^^^^^^^^^^ 175 | redocOptions: getObjectOrJSON(argv.options), | ^^^^^^^^^^^^^^^^^ 176 | }; | ^^^^^^^^^^^^^^^^^ 177 | | ^^^^^^^^^^^^^^^^^ 178 | try { | ^^^^^^^^^^^^^^^^^ 179 | notifyUpdateCliVersion(); | ^^^^^^^^^^^^^^^^^ 180 | await serve(argv.host as string, argv.port as number, argv.spec as string, config); | ^^^^^^^^^^^^^^^^^ 181 | } catch (e) { | ^^^^^^^^^^^^^^^^^ 182 | handleError(e); | ^^^^^^^^^^^^^^^^^ 183 | } | ^^^^^^^^^^^^^^^^^ 184 | }, | ^^^^^^^^^^^^^^^^^ 185 | [ | ^^^^^^^^^^^^^^^^^ 186 | res => { | ^^^^^^^^^^^^^^^^^ 187 | console.log( | ^^^^^^^^^^^^^^^^^ 188 | \n⚠️ This command is deprecated. Use "npx @redocly/cli preview-docs petstore.yaml"\n, | ^^^^^^^^^^^^^^^^^ 189 | ); | ^^^^^^^^^^^^^^^^^ 190 | return res; | ^^^^^^^^^^^^^^^^^ 191 | }, | ^^^^^^^^^^^^^^^^^ 192 | ], | ^^^^^^^^^^^^^^^^^ 193 | ) | ^^^^^^^^^^^^^^^^^ 194 | .command( | ^^^^^^^^^^^^^^^^^ 195 | 'build ', | ^^^^^^^^^^^^^^^^^ 196 | 'build definition into zero-dependency HTML-file', | ^^^^^^^^^^^^^^^^^ 197 | builderForBuildCommand, | ^^^^^^^^^^^^^^^^^ 198 | handlerForBuildCommand, | ^^^^^^^^^^^^^^^^^ 199 | ) | ^^^^^^^^^^^^^^^^^ 200 | .command( | ^^^^^^^^^^^^^^^^^ 201 | 'bundle ', | ^^^^^^^^^^^^^^^^^ 202 | 'bundle spec into zero-dependency HTML-file [deprecated]', | ^^^^^^^^^^^^^^^^^ 203 | builderForBuildCommand, | ^^^^^^^^^^^^^^^^^ 204 | handlerForBuildCommand, | ^^^^^^^^^^^^^^^^^ 205 | [ | ^^^^^^^^^^^^^^^^^ 206 | res => { | ^^^^^^^^^^^^^^^^^ 207 | console.log(\n⚠️ This command is deprecated. Use "build" command instead.\n); | ^^^^^^^^^^^^^^^^^ 208 | return res; | ^^^^^^^^^^^^^^^^^ 209 | }, | ^^^^^^^^^^^^^^^^^ 210 | ], | ^^^^^^^^^^^^^^^^^ 211 | ) | ^^^^ 212 | .demandCommand() 213 | .options('t', { 214 | alias: 'template',

ERROR in src/components/SideMenu/styled.elements.ts:1:10

TS2305: Module '"../../../node_modules/classnames"' has no exported member 'default'.

1 | import { default as classnames } from 'classnames'; | ^^^^^^^ 2 | import { darken } from 'polished'; 3 | 4 | import { deprecatedCss, ShelfIcon } from '../../common-elements';

lornajane commented 11 months ago

I know we made some changes to our dependencies since this issue was reported. Could you confirm if you're still unable to build the most recent release on windows please?