Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: createGlobalStyle is not a function when using redoc-cli #698

Closed
idelsink opened this issue Nov 5, 2018 · 9 comments
Closed

Comments

@idelsink
Copy link

idelsink commented Nov 5, 2018

When using the latest redoc-cli (0.6.4), which uses redoc@v2.0.0-alpha.41, I get the following error:

TypeError: createGlobalStyle is not a function

Steps to reproduce

  1. Get the perstore OpenAPI 3 spec: examples/v3.0/petstore.yaml
  2. Run redoc-cli on the petstore:
    redoc-cli bundle petstore.yaml -o petstore/

Stack trace

/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:7303
var PSStyling = createGlobalStyle(perfect_scrollbar_templateObject_1 || (perfect_scrollbar_templateObject_1 = external_tslib_["__makeTemplateObject"](["", ""], ["", ""])), perfect_scrollbar_default.a && perfect_scrollbar_default.a.toString());
                ^

TypeError: createGlobalStyle is not a function
    at Module.<anonymous> (/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:7303:17)
    at __webpack_require__ (/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:36:30)
    at /usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:100:18
    at /usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:103:10
    at webpackUniversalModuleDefinition (/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:9:20)
    at Object.<anonymous> (/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:16:3)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
@brushmate
Copy link
Contributor

Adding styled-components 4.0.3 to the dependencies solved it for me.

@ghost
Copy link

ghost commented Nov 6, 2018

Don't work for me... I am on windows 10 OS. and using latest code from master branch

  1. npx redoc-cli bundle openapi.yaml
  2. createGlobalStyle is not a function

@tmsnvd
Copy link

tmsnvd commented Nov 6, 2018

Does not help.

redoc@2.0.0-alpha.41

yarn add styled-components@4.0.3

npx redoc-cli --version

createGlobalStyle is not a function

@idelsink
Copy link
Author

idelsink commented Nov 6, 2018

I'm not sure that simply adding the peer dependency styled-components is a viable solution. As indicated by other people, this does not seem to solve the issue.

@RomanHotsiy
Copy link
Member

Could you please try redoc-cli@0.7.0?

@tmsnvd
Copy link

tmsnvd commented Nov 6, 2018

It works

@idelsink
Copy link
Author

idelsink commented Nov 6, 2018

It's seems that the release of redoc-cli@0.7.0 fixes the problem. However I'm still not sure that adding the peer dependency of styled-components is a viable solution.

@RomanHotsiy
Copy link
Member

@idelsink it is.
redoc is using styled components as a peerDependency and recently the code base was updated to use styled-components@4 which doesn't have injectGlobalStyle anymore.
redoc-cli included redoc as a dependency so has to install valid version of its peer dependencies itself. Before redoc-cli used styled-components@3.x which is incompatible with 4.x

@jwedel
Copy link

jwedel commented Nov 7, 2018

Can confirm: using redoc-cli@0.7.0 works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants