{"id":2121,"date":"2017-11-14T16:22:45","date_gmt":"2017-11-14T21:22:45","guid":{"rendered":"https:\/\/bitpost.com\/news\/?p=2121"},"modified":"2017-11-21T19:23:24","modified_gmt":"2017-11-22T00:23:24","slug":"node-dependency-headaches","status":"publish","type":"post","link":"https:\/\/bitpost.com\/news\/2017\/node-dependency-headaches\/","title":{"rendered":"Node dependency headaches"},"content":{"rendered":"<p>My headaches described below were due to my npm module&#8217;s dependency clauses&#8217; versioning stanzas.  I had set dependencies to automatically update but clipped them to the current minor version.  Eventually they got crusty, and npm actually stopped finding the versions I was demanding in a speedy fashion.  Both edges of the upgrade knife can cut you, don&#8217;t let dependencies get too old.  \ud83d\ude42  Fuller explanation on <a href=\"https:\/\/stackoverflow.com\/a\/47225923\/717274\">SO<\/a>.<\/p>\n<p>Historical blathering follows&#8230;<!--more--><\/p>\n<p>Haven&#8217;t figured out why yet, but note to self: node shits itself with dependency problems if you go from 7.2.0 to 8.1.2. \u00a0I&#8217;m using nvm to switch around, so switching back was trivial. \u00a0I have my default set to 7.2.0 for now until I have time to figure out what&#8217;s going on in more detail.<\/p>\n<p>UPDATE: seems to work again after cleaning out all my local module folders [rm -rf node_modules] and redoing [npm install -g].<\/p>\n<p>UPDATE: I upgraded my box and that kicked off nvm into upgrading npm. \u00a0Once you switch npm versions, it starts using an entirely new global cache. \u00a0So there you have it. \u00a0\ud83d\ude42<\/p>\n<p>UPDATE: Also, on my laptop [viper], I had a stray package-lock.json, a nasty file that locks you out of upgrades, which can screw you over at times. \u00a0Or screw you over if you don&#8217;t use one. \u00a0YMMV.<\/p>\n<p>UPDATE: it&#8217;s too early to start using this release &#8211; roll back to the last LTS, 6.11.2 as of 2017-08-15. \u00a0nvm takes the blame, it gets wonky if you had it pointing to a version that disappears. \u00a0Do this:<\/p>\n<blockquote>\n<pre><code>m@viper:~$ <strong>nvm alias stable lts\/boron <\/strong><\/code> <code>stable -&gt; lts\/boron (-&gt; v6.11.2) <\/code> <code>m@viper:~$ <strong>nvm alias <\/strong><\/code> <code>default -&gt; node (-&gt; v6.11.2) <\/code> <code>node -&gt; stable (-&gt; v6.11.2) <\/code> <code>stable -&gt; lts\/boron (-&gt; v6.11.2) <\/code> <code>iojs -&gt; N\/A (default) <\/code> <code>lts\/* -&gt; lts\/boron (-&gt; v6.11.2) <\/code> <code>lts\/argon -&gt; v4.8.4 (-&gt; N\/A) <\/code> <code>lts\/boron -&gt; v6.11.2<\/code><\/pre>\n<\/blockquote>\n<p>UPDATE: <a href=\"https:\/\/stackoverflow.com\/a\/47225923\/717274\">nvm with lts<\/a> is the new solution<\/p>\n<blockquote>\n<pre><code>nvm install --lts<\/code><\/pre>\n<\/blockquote>\n<p>Also, IRONICALLY, be careful trying to control dependency versions, as they may actually go out of favor and slow npm down trying to extract them.  On occassion, in controlled fashion, upgrade your dependencies.  This is the only truth in today&#8217;s development world.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My headaches described below were due to my npm module&#8217;s dependency clauses&#8217; versioning stanzas. I had set dependencies to automatically update but clipped them to the current minor version. Eventually they got crusty, and npm actually stopped finding the versions I was demanding in a speedy fashion. Both edges of the upgrade knife can cut [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[216,237],"tags":[274,273],"class_list":["post-2121","post","type-post","status-publish","format-standard","hentry","category-node-js","category-rad-scripts","tag-npm","tag-nvm"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9M11L-yd","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/2121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/comments?post=2121"}],"version-history":[{"count":13,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/2121\/revisions"}],"predecessor-version":[{"id":2191,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/2121\/revisions\/2191"}],"wp:attachment":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/media?parent=2121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/categories?post=2121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/tags?post=2121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}