Redoc: Problem installing [email protected] - styled-components is missing

Created on 28 Sep 2018  ยท  7Comments  ยท  Source: Redocly/redoc

We're using [email protected] in our pipeline for generating our documentation automatically.

Today we're facing a major problem when trying to install it. What's strange is that we're using version 0.6.1 for two months now without any problems. Today we started receiving the following problem without changing anything.

/usr/local/bin/redoc-cli -> /usr/local/lib/node_modules/redoc-cli/index.js
- [email protected] node_modules/redoc-cli/node_modules/nice-try
- [email protected] node_modules/redoc-cli/node_modules/p-defer
- [email protected] node_modules/redoc-cli/node_modules/map-age-cleaner
- [email protected] node_modules/redoc-cli/node_modules/p-is-promise
- [email protected] node_modules/redoc-cli/node_modules/semver
- [email protected] node_modules/redoc-cli/node_modules/xregexp
/usr/local/lib
โ””โ”€โ”ฌ [email protected] 
  โ”œโ”€โ”€ UNMET PEER DEPENDENCY styled-components@^3.4.0
  โ””โ”€โ”ฌ [email protected] 
    โ”œโ”€โ”€ [email protected] 
    โ”œโ”€โ”ฌ [email protected] 
    โ”‚ โ””โ”€โ”ฌ [email protected] 
    โ”‚   โ””โ”€โ”ฌ [email protected] 
    โ”‚     โ””โ”€โ”ฌ [email protected] 
    โ”‚       โ””โ”€โ”€ [email protected] 
    โ”œโ”€โ”ฌ [email protected] 
    โ”‚ โ”œโ”€โ”ฌ [email protected] 
    โ”‚ โ”‚ โ””โ”€โ”ฌ [email protected] 
    โ”‚ โ”‚   โ””โ”€โ”ฌ [email protected] 
    โ”‚ โ”‚     โ”œโ”€โ”€ [email protected] 
    โ”‚ โ”‚     โ””โ”€โ”€ [email protected] 
    โ”‚ โ”œโ”€โ”ฌ [email protected] 
    โ”‚ โ”‚ โ””โ”€โ”€ [email protected] 
    โ”‚ โ””โ”€โ”€ [email protected] 
    โ”œโ”€โ”€ [email protected] 
    โ””โ”€โ”€ [email protected] 

npm WARN [email protected] requires a peer of styled-components@^3.4.0 but none was installed.

Our script for installing the redoc-cli is the following:

#!/usr/bin/env bash

version=$(node -p "require('redoc-cli/package.json').version" 2>/dev/null)
[ "$version" == "0.6.1" ] || npm install -g [email protected]

redoc-cli bundle docs/api/specification.yml -o docs/index.html

We're helpless Java developers not knowing how we can fix that. Any help will be much appreciated

Thanks in advance

Most helpful comment

My fault ๐Ÿ™ˆ. Should be fixed in 0.6.4

All 7 comments

I am having the exact same problem. I dug a little deeper and tried to use npx to just print the version number to see if there was any kind of breaking change. I went through version 0.6.2, 0.6.1, 0.5.0, and 0.4.0 and all of them had the same issue.

docker run --rm node:8-alpine npx redoc-cli --version

npx: installed 120 in 5.969s
Cannot find module 'styled-components'

Ahh. Yes. IN the latest ReDoc alpha I moved styled-components to peerDependencies and forgot to update redoc-cli.

And redoc-cli installs each time the newest ReDoc version ("^2.0.0-alpha.37").

This issue should have been fixed in [email protected]. Could you verify?

To avoid similar issues in the future, use package-lock.json or yarn.lock. This way each redoc-cli install will install with the exact same version of dependencies.

I had the same error with 0.6.1.

With 0.6.3, a different error occurs:

!/usr/bin/env bash

version=$(node -p "require('redoc-cli/package.json').version" 2>/dev/null)
[ "$version" == "0.6.3" ] || npm install -g [email protected]

redoc-cli bundle docs/api/specification.yml -o docs/index.html

npm ERR! path /usr/local/lib/node_modules/redoc-cli/index.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/redoc-cli/index.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

My fault ๐Ÿ™ˆ. Should be fixed in 0.6.4

@RomanGotsiy no worries! Thank you for responding that quickly ๐Ÿ‘

works! thanks so much for responding so quick @RomanGotsiy

(we'd got as far as figuring out it was pulling the latest 'redoc' alpha, but we were a bit stuck)

๐ŸŽ‰

Was this page helpful?
0 / 5 - 0 ratings

Related issues

martnst picture martnst  ยท  3Comments

dwilding picture dwilding  ยท  4Comments

gavinkalika picture gavinkalika  ยท  3Comments

zmes50416 picture zmes50416  ยท  3Comments

yuji38kwmt picture yuji38kwmt  ยท  3Comments