<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vlatko Koudela</title>
    <description>The latest articles on DEV Community by Vlatko Koudela (@vkoudela).</description>
    <link>https://dev.to/vkoudela</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F237406%2F3beaee84-c4ac-4dd9-b29a-ffa2d829e74e.jpeg</url>
      <title>DEV Community: Vlatko Koudela</title>
      <link>https://dev.to/vkoudela</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vkoudela"/>
    <language>en</language>
    <item>
      <title>How to fix "Received invalid response from npm" when using other registry in .npmrc and .yarnrc</title>
      <dc:creator>Vlatko Koudela</dc:creator>
      <pubDate>Tue, 26 Nov 2019 21:40:43 +0000</pubDate>
      <link>https://dev.to/vkoudela/how-to-fix-received-invalid-response-from-npm-when-using-other-registry-in-npmrc-and-yarnrc-173f</link>
      <guid>https://dev.to/vkoudela/how-to-fix-received-invalid-response-from-npm-when-using-other-registry-in-npmrc-and-yarnrc-173f</guid>
      <description>&lt;p&gt;Working on long term projects and keeping up with the technologies can be hard. It may happen that some of the technologies you're using change their configuration setting and you don't see their docs on time or you simply - forget. This happened to me while using the pro version of FontAwesome. Their license "authentication" has changed over time and that's fine if your project is young, but it's less obvious when working on long term project.&lt;/p&gt;

&lt;p&gt;If you're reading this article, then you might be taken here by search engine that crawled this error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;error Received invalid response from npm.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In my case, I got this error while trying to execute &lt;code&gt;yarn info prop-types&lt;/code&gt;, but it can be any package from your packages.json file.&lt;/p&gt;

&lt;p&gt;During the problem, &lt;code&gt;yarn install&lt;/code&gt; doesn't work so you may end up with the similar looking error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn install v1.19.2
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
error An unexpected error occurred: "https://npm.example.com/prop-types/-/prop-types-15.7.2.tgz: Request failed \"404 Not Found\"".
info If you think this is a bug, please open a bug report with the information provided in "/Users/vkoudela/path-to/your-project/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you encounter this or similar problem, many developers would say:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Delete &lt;code&gt;node_modules&lt;/code&gt; folder and then try &lt;code&gt;yarn install&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Delete &lt;code&gt;node_modules&lt;/code&gt;, &lt;code&gt;yarn.lock&lt;/code&gt; and then try again&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;yarn cache clean&lt;/code&gt; and then try again&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;But, what if you already tried that and it didn't help?&lt;/p&gt;

&lt;p&gt;We, developers, when trying to fix something, we tend to run something and then we see what happens. We fix one problem, then another, until we fix all of them.&lt;/p&gt;

&lt;p&gt;So, to be able to solve your problem, you have to know in which order &lt;code&gt;yarn&lt;/code&gt; is using *rc files.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In your project root (folder where you have your packages.json), it looks for &lt;code&gt;.yarnrc&lt;/code&gt; file&lt;/li&gt;
&lt;li&gt;Then it looks for &lt;code&gt;.npmrc&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Then it tries to find those files globally, which is usually your user folder: &lt;code&gt;~/.yarnrc&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Then it tries the same thing with &lt;code&gt;~/.npmrc&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;While troubleshooting and "fixing" the problem, you have to be aware of the fact that even if &lt;code&gt;yarn install&lt;/code&gt; fails to execute properly, it would still create &lt;code&gt;yarn.lock&lt;/code&gt; file taking all the settings from all &lt;code&gt;.npmrc&lt;/code&gt; and &lt;code&gt;.yarnrc&lt;/code&gt; on all four locations on your file system. So, even if you change any of the *rc files on any location after first failed attempt, it's not enough because settings are written in &lt;code&gt;yarn.lock&lt;/code&gt; and yarn will reuse them on next execution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Therefore, don't forget to delete &lt;code&gt;yarn.lock&lt;/code&gt; before every other attempt of &lt;code&gt;yarn install&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>yarn</category>
      <category>npm</category>
    </item>
  </channel>
</rss>
