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

Received malformed response from registry for undefined. When adding proxy to yarn config file #4771

Closed
aimad-majdou opened this issue Oct 24, 2017 · 51 comments
Labels

Comments

@aimad-majdou
Copy link

aimad-majdou commented Oct 24, 2017

Do you want to request a feature or report a bug?

bug

What is the current behavior?

I moved from using bower to yarn, and in my .bowerrc file I had as following:

{
    "directory": "src/main/webapp/bower_components",
    "proxy": "http://webdefence.global.blackspider.com:80",
    "https-proxy": "http://webdefence.global.blackspider.com:80"
}

And in .npmrc file I had as following :

save-prefix = ~
proprietary-attribs = false
registry = http://abc-pic:8081/nexus/content/repositories/npmjs/

So I removed these two files and I run the following commands :

yarn config set https-proxy http://webdefence.global.blackspider.com:80
yarn config set proxy http://webdefence.global.blackspider.com:80
yarn set registry http://abc-pic:8081/nexus/content/repositories/npmjs/
yarn config set proprietary-attribs false
yarn config set save-prefix ~

And then I run the following command :

yarn install --force --flat --production --modules-folder src/main/webapp/bower_components

But then I receive this error :

error Received malformed response from registry for undefined. The registry may be down.

Yarn config list

{ 'version-tag-prefix': 'v',
  'version-git-tag': true,
  'version-git-sign': false,
  'version-git-message': 'v%s',
  'init-version': '1.0.0',
  'init-license': 'MIT',
  'save-prefix': '~',
  'ignore-scripts': false,
  'ignore-optional': false,
  registry: 'http://abc-pic:8081/nexus/content/repositories/npmjs/',
  'strict-ssl': true,
  'user-agent': 'yarn/1.2.1 npm/? node/v5.1.0 win32 x64',
  'https-proxy': 'http://webdefence.global.blackspider.com:80',
  lastUpdateCheck: 1508835683941,
  'modules-folder': 'src/main/webapp/bower_components',
  'proprietary-attribs': false,
  'proproprietary-attribs': false,
  proxy: 'http://webdefence.global.blackspider.com:80' }
info npm config
{}

What is the expected behavior?

yarn install works.

Please mention your node.js, yarn and operating system version.

OS : windows 7 win32 x64
node version : 5.1.0
yarn version : 1.2.1
npm version : 3.3.12

@aimad-majdou aimad-majdou changed the title error Received malformed response from registry for undefined. The registry may be down Received malformed response from registry for undefined. When adding proxy to yarn config file Oct 24, 2017
@rally25rs
Copy link
Contributor

rally25rs commented Oct 24, 2017

Could you also add the flag --verbose and get the output? Hopefully that will indicate what URL it is trying to hit when it reports this error.

It should end up making a request to something like "http://abc-pic:8081/nexus/content/repositories/npmjs/{package-name}" so you could pop that URL into your browser and also let us know what the registry sends back as a response.

@aimad-majdou
Copy link
Author

aimad-majdou commented Oct 25, 2017

@rally25rs This is what I got running the install with the flag --verbose :

[1/4] Resolving packages...
verbose 0.709 Performing "GET" request to "http://abc-pic:8081/nexus/content/repositories/npmjs/angular".
verbose 0.969 Request "http://abc-pic:8081/nexus/content/repositories/npmjs/angular" finished with status code 503.
verbose 0.979 Error: Received malformed response from registry for undefined. The registry may be down.
    at MessageError (C:\Dev\Workspace\ABC\webapps\rhweb\node\node_modules\yarn\lib\cli.js:138:26)
    at C:\Dev\Workspace\ABC\webapps\rhweb\node\node_modules\yarn\lib\cli.js:48854:15
    at next (native)
    at step (C:\Dev\Workspace\ABC\webapps\rhweb\node\node_modules\yarn\lib\cli.js:92:30)
    at C:\Dev\Workspace\ABC\webapps\rhweb\node\node_modules\yarn\lib\cli.js:110:14
    at new Promise (C:\Dev\Workspace\ABC\webapps\rhweb\node\node_modules\yarn\lib\cli.js:93019:7)
    at C:\Dev\Workspace\ABC\webapps\rhweb\node\node_modules\yarn\lib\cli.js:89:12
    at Function.findVersionInRegistryResponse (C:\Dev\Workspace\ABC\webapps\rhweb\node\node_modules\yarn\lib\cli.js:48885:7)
    at C:\Dev\Workspace\ABC\webapps\rhweb\node\node_modules\yarn\lib\cli.js:48902:28
    at next (native)
error Received malformed response from registry for undefined. The registry may be down.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Opening the url http://abc-pic:8081/nexus/content/repositories/npmjs/angular in the browser I get the following :

output.log

@rally25rs
Copy link
Contributor

rally25rs commented Oct 26, 2017

... finished with status code 503

makes it sound like the registry (or proxy) might be throwing an error when Yarn hits it.

The code that prints that message is:

if (!body['dist-tags']) {
  throw new MessageError(config.reporter.lang('malformedRegistryResponse', body.name));
}

so whatever Yarn happens to be getting back doesn't have a dist-tags property in the response body. It's quite possible that there is some difference between Yarn and the browser making the GET request, possible a different http header or something? Not really sure...


If you want to try debugging this, you could build yarn from the source, and inside that if statement above, add a console.log(body) and see what yarn is actually getting.

@aimad-majdou
Copy link
Author

@rally25rs I noticed that this behavior only occurs when I set proxy and https-proxy to http://webdefence.global.blackspider.com:80 which I used in .bowerrc

@Vall3y
Copy link

Vall3y commented Mar 14, 2018

This is not a solution for your bug, but you also get an error like that if you have an illegal package name (such as an empty string " ": "1.0.0")

@joshunger
Copy link

joshunger commented Mar 20, 2018

This also happens if you have a registry that can't be accessed (like only via VPN) but your internet provider returns a backup HTML page. 😃 If you want a PR let me know what you specifically want fixed.

Here is my .npmrc -
image

Here is curl -v -
image

yarn add prop-types --verbose
image

@knoxcard
Copy link

knoxcard commented May 22, 2018

Prior to today yarn upgrade has always been flawless. It appears I've encountered this yarn registry bug or error, Shouldn't the default behavior error out to the console but move on and process everything else that is available?

@flewid-cd
Copy link

+1

@tahv0
Copy link

tahv0 commented May 22, 2018

+1 Having this issue right now

@echoulen
Copy link

Now is very slow without .yarnrc and yarn.lock

@philipjc
Copy link

philipjc commented May 22, 2018

Getting this issue using create-react-app. Yarn 1.6

@technobia
Copy link

It back to normal currently :)

@zaiz91
Copy link

zaiz91 commented May 22, 2018

+1

@nadzic
Copy link

nadzic commented May 22, 2018

Still down :>

@glennreyes
Copy link

Same here!

@technobia
Copy link

technobia commented May 22, 2018

Work for me yarn@1.5.1

@izaika
Copy link

izaika commented May 22, 2018

+1

@knoxcard
Copy link

knoxcard commented May 22, 2018

Rooting for you guys, don't want to go back to that stone age package manager....SAPM...aka...NPM

@echoulen
Copy link

npm is very slow too

@flewid-cd
Copy link

yes npm is also downish.

@flewid-cd
Copy link

so maybe not a yarn issue.

@EJIqpEP
Copy link

EJIqpEP commented May 22, 2018

It's for sure npm issue because https://registry.npmjs.org/ is 503.
UPD: Fixed now

@vrajau
Copy link

vrajau commented May 22, 2018

Working again now!

@philipjc
Copy link

I just had a successful, create-react-app

@knoxcard
Copy link

knoxcard commented May 22, 2018

NPM is still causing problems even though I've switched to Yarn? Interesting...

@flewid-cd
Copy link

@knoxcard yarn is on top of npm.

@DmitryAstafyev
Copy link

DmitryAstafyev commented May 22, 2018

Amazing. So many things depend on one service and there is no quick way around :/ Something is wrong definitely.
Works again, but until next malfunction I guess.

@vrajau
Copy link

vrajau commented May 22, 2018

The day npm is definitely down, we are all doomed.

@flewid-cd
Copy link

Down again.

@echoulen
Copy link

Down again +1

@flewid-cd
Copy link

flewid-cd commented May 22, 2018

@knoxcard
Copy link

@flewid-cd Yarn should get beneath NPM and then rise like a Phoenix.

@rubyjasmin
Copy link

Down again +1

@brisqqltd
Copy link

#5885

@SupremeTechnopriest
Copy link

Error: Received malformed response from registry for undefined. The registry may be down.

@lednhatkhanh
Copy link

Down again...

@ghost
Copy link

ghost commented May 30, 2018

@lednhatkhanh Up now.

@ghost
Copy link

ghost commented May 30, 2018

Ohhh. It's down again. https://registry.yarnpkg.com/

The yarn registry is down but the it is shown as in operational state on https://status.yarnpkg.com/

@yarindeoh
Copy link

+1

@Rud156
Copy link

Rud156 commented May 30, 2018

Down Again.

@daveconnis
Copy link

daveconnis commented May 30, 2018

Was getting the same error for a yarn add, but I tried it again and we're golden. What is technology, even.

@VolodymyrLadnov
Copy link

+1

@aledmb
Copy link

aledmb commented May 30, 2018

What is your back up strategy? npm?

@aledmb
Copy link

aledmb commented May 30, 2018

btw, just so people understand the issue... https://twitter.com/jamiebuilds/status/1000198463269699584

@BYK BYK closed this as completed May 30, 2018
@BYK
Copy link
Member

BYK commented May 30, 2018

I closed this issue since it diverged from the original description quite a lot. @rally25rs feel free to create a new one to track the original issue.

@missMHWGO
Copy link

This also happens if you have a registry that can't be accessed (like only via VPN) but your internet provider returns a backup HTML page. If you want a PR let me know what you specifically want fixed.

Here is my .npmrc -
image

Here is curl -v -
image

yarn add prop-types --verbose
image

@joshunger Could you please tell me how to have such a cute and lovely terminal prompt?Wo~~~I like it~~~
37642677-b844120c-2be3-11e8-9f5c-a5423b3fdf66

artemv added a commit to artemv/yarn-retry that referenced this issue Dec 18, 2019
@hayelom123
Copy link

hayelom123 commented Sep 11, 2021

yeah the same here

@webprogrammierer
Copy link

I have this errors using my Ubuntu VM (Drupal VM) to install packages or to run 'yarn install' and other command.
I have this errors since I have installed Docker & WSL 2 on my Windows 10 Pro.

How can those network issues be solved?

@km4dlpx
Copy link

km4dlpx commented Sep 27, 2022

Error: Received malformed response from registry for "webpack". The registry may be down.

I am getting this again and again, how we can solve it?

@joshuaebowling
Copy link

For anyone else who may be having this problem... for me, it turned out that a package I had installed had an empty name " ". Once I removed that reference, the packages started to flow again :)

@shadowctrl
Copy link

deleted .yarn-lock solved my issue

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

No branches or pull requests