Redocly / Redocly/redoc

Can't build on windows 10

Open
#2,229 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question Type: Bug
Dominant language
TypeScript
Stars
25.9k
Forks
2.4k
Avg merge
13h 10m
Merged PRs (30d)
4

Description

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:
- add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "url": false }

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:
- add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "url": false }

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';

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Windows build and start with the reported errors in src/utils/helpers.ts and cli/index.ts. Check the project’s dependency and build configuration for the missing modules and TypeScript errors, then verify that the local version builds successfully on Windows 10.

Written by the indexing model from the issue text.

Assessment

Tech stack
handlebars, node.js, typescript, webpack
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.