TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Do not use NPM 5.7

544 pointsby jguimontabout 7 years ago

35 comments

zaarnabout 7 years ago
Excuse me, but what the fuck?<p>Looks like the line responsible checks if the npm binary is run as sudo and then uses the UID and GID of the invoking user when chowning the directory. [ <a href="https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;npm&#x2F;blob&#x2F;latest&#x2F;lib&#x2F;utils&#x2F;correct-mkdir.js#L54" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;npm&#x2F;blob&#x2F;latest&#x2F;lib&#x2F;utils&#x2F;correct-mkd...</a> ]<p>I feel like screaming, who thought this was a good idea? If I invoke something as sudo, why does anyone think it should try to detect that and do anything about it? I want to run as the user sudo has set, not my own user, <i>OBVIOUSLY</i>.<p>Don&#x27;t try to be smart about sudo, you will break stuff.
评论 #16440833 未加载
评论 #16440322 未加载
评论 #16438393 未加载
评论 #16439926 未加载
评论 #16447516 未加载
lucideerabout 7 years ago
This is really horrific.<p>The idea that correctMkdir() exists at all seems to me to be so wrong-headed.<p>This comment from the source says a lot:<p><pre><code> &#x2F;&#x2F; annoying humans and their expectations! </code></pre> Good UX is an important, oft-overlooked consideration, but there is definitely such a thing as taking it too far. If your humans are expecting this level of hand-holding, it&#x27;s because you&#x27;ve trained them to expect it by pandering to them up until now. This is the kind of problem that should be handled with good, detailed, error message display when users don&#x27;t get the result they expect, not &quot;fixing&quot; it with over-reaching magic.<p>I&#x27;m not sure I&#x27;d trust anything put out by the npm team in general from hereonin if they genuinely thought creating the correct-mkdir.js file in the first place was a reasonable idea. Is it? Genuinely open to a counter-argument.
评论 #16443137 未加载
评论 #16438449 未加载
评论 #16441330 未加载
btownabout 7 years ago
There appear to be no unit tests for their entire lib&#x2F;utils folder. Which includes things like this (misguided) chown utility. <a href="https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;npm&#x2F;tree&#x2F;release-next&#x2F;test" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;npm&#x2F;tree&#x2F;release-next&#x2F;test</a> - and note the lack of testing in the commit linked in the bug report.<p>I had an inkling that NPM was cancer, but not like this.<p>Yarn, by contrast, has everything you would expect of a Facebook-engineered library: <a href="https:&#x2F;&#x2F;github.com&#x2F;yarnpkg&#x2F;yarn&#x2F;tree&#x2F;master&#x2F;__tests__&#x2F;util" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;yarnpkg&#x2F;yarn&#x2F;tree&#x2F;master&#x2F;__tests__&#x2F;util</a><p>Will be closely evaluating a switch to Yarn for our live apps. This is simply sad.
评论 #16437697 未加载
评论 #16441108 未加载
officialchickenabout 7 years ago
It&#x27;s been almost 2 years since the great left-pad debacle[0]. The last major npm issue[1] was less than 2 months ago. While the underlying npm registry security issues will remain for a while (and other languages don&#x27;t seem to have these issues with their package managers), there doesn&#x27;t seem like there&#x27;s too much I can do other than use yarn. And hope an alternative registry will appear.<p>Since I &#x27;vote&#x27; with my code - this migration page has been helpful today - and I hope it will help others: <a href="https:&#x2F;&#x2F;yarnpkg.com&#x2F;lang&#x2F;en&#x2F;docs&#x2F;migrating-from-npm&#x2F;" rel="nofollow">https:&#x2F;&#x2F;yarnpkg.com&#x2F;lang&#x2F;en&#x2F;docs&#x2F;migrating-from-npm&#x2F;</a><p>It took me ~5 mins to migrate all of my code from npm to yarn. But I don&#x27;t have complex CI tasks either.<p>I use ncu to check updates every couple of days, sometimes more frequently. To further distance myself from npm, can anyone comment on the pros&#x2F;cons of github repo paths instead of package names in package.json?<p>[0] <a href="https:&#x2F;&#x2F;www.theregister.co.uk&#x2F;2016&#x2F;03&#x2F;23&#x2F;npm_left_pad_chaos" rel="nofollow">https:&#x2F;&#x2F;www.theregister.co.uk&#x2F;2016&#x2F;03&#x2F;23&#x2F;npm_left_pad_chaos</a><p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;registry&#x2F;issues&#x2F;255" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;registry&#x2F;issues&#x2F;255</a><p>*edit: formatting
评论 #16440914 未加载
评论 #16440937 未加载
评论 #16442738 未加载
评论 #16445009 未加载
评论 #16455246 未加载
jlgaddisabout 7 years ago
I just can&#x27;t feel sorry for folks when I see comments like this one:<p>&gt; <i>This destroyed 3 production server after a single deploy!</i><p>I do think that the developers have a duty to do some testing of their software before putting out releases&#x2F;updates. However, <i>users</i> also have a duty to perform sufficient testing before they push new versions to their production environments.<p>In my opinion, it&#x27;s kinda like losing data because you didn&#x27;t make and&#x2F;or test your backups. It&#x27;s a really crappy way to have to learn a lesson but at least they&#x27;ve finally learned it -- and if they haven&#x27;t, well, then maybe they will the <i>next</i> time it happens.
评论 #16439296 未加载
评论 #16438630 未加载
评论 #16439650 未加载
评论 #16439876 未加载
评论 #16438731 未加载
评论 #16439754 未加载
boffinismabout 7 years ago
Good lord, when I try to follow the link I get the Unicorn error page with the message &#x27;This page is taking way too long to load. Sorry about that. Please try refreshing and contact us if the problem persists.&#x27;<p>Has this issue provoked so much outrage that GitHub can&#x27;t handle the constant stream of angry emojis on the issue comment thread?
评论 #16438544 未加载
评论 #16438559 未加载
评论 #16441302 未加载
评论 #16438586 未加载
foepysabout 7 years ago
Apart from being a horrific bug, why are people running npm as root? Why don&#x27;t they install it somewhere below $HOME and modify $PATH? npm is working fine without root permissions.<p>Everything is super dangerous as root, one should avoid using root at all costs until there is no other way.
评论 #16438933 未加载
评论 #16444684 未加载
评论 #16439019 未加载
评论 #16438619 未加载
master-littyabout 7 years ago
<a href="http:&#x2F;&#x2F;blog.npmjs.org&#x2F;post&#x2F;171169301000&#x2F;v571" rel="nofollow">http:&#x2F;&#x2F;blog.npmjs.org&#x2F;post&#x2F;171169301000&#x2F;v571</a><p><pre><code> Thankfully, it only affected users running `npm@next`, which is part of our staggered release system #STOPUSINGPRERELEASEWITHSUDO </code></pre> Really now?<p><pre><code> #ANGRYORANGEWEBSITE #PEOPLEGOTMAD </code></pre> :)
评论 #16440966 未加载
评论 #16440620 未加载
mkjabout 7 years ago
Reminds me of a recent Yarn problem, overwriting which(1). <a href="https:&#x2F;&#x2F;github.com&#x2F;yarnpkg&#x2F;yarn&#x2F;issues&#x2F;4205" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;yarnpkg&#x2F;yarn&#x2F;issues&#x2F;4205</a>
评论 #16437664 未加载
评论 #16438461 未加载
hysanabout 7 years ago
Doesn&#x27;t really surprise me when you have other issues like this (<a href="https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;npm&#x2F;issues&#x2F;17929" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;npm&#x2F;issues&#x2F;17929</a>) that have persisted for a long time. NPM 5.x in general hasn&#x27;t been very stable.
评论 #16439432 未加载
nwhattabout 7 years ago
Wow the toxicity on that thread is appalling. I feel like I need to a tool when hiring people that automatically shows me their github comments with the most reactions.
akras14about 7 years ago
Wayback link, of someone has a better mirror please post: <a href="http:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20180222170341&#x2F;https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;npm&#x2F;issues&#x2F;19883" rel="nofollow">http:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20180222170341&#x2F;https:&#x2F;&#x2F;github.com...</a>
InclinedPlaneabout 7 years ago
From: <a href="https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;npm&#x2F;releases&#x2F;tag&#x2F;v5.7.1" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;npm&#x2F;releases&#x2F;tag&#x2F;v5.7.1</a><p><i>&quot;Thankfully, it only affected users running npm@next, which is part of our staggered release system, which we use to prevent issues like this from going out into the wider world before we can catch them. Users on latest would have never seen this!&quot;</i><p>If you are updating to the latest pre-release of something within mere <i>hours</i> of it dropping and you are updating production systems (presumably that have some business value) with no previous testing then the consequences of that aren&#x27;t on the devs they are 100% on you. And you don&#x27;t deserve to call yourself an IT (or Ops or DevOps or what-have-you) professional, that is amateurish behavior in the extreme.
RX14about 7 years ago
My personal opinion is that the root cause of the issue is the ability of a <i>language</i> pacakge manager to mess with system files at all (i.e. do a global install of anything). Shards, the crystal package manager makes the sensible design decision to only install libraries into `$PWD&#x2F;lib` and binaries into `$PWD&#x2F;bin`. Everything is local only to your project. If you want a binary on your PATH, you can create an installation method that works for your commandline tool&#x27;s specific usecase. Hopefully a distro&#x2F;homebrew package.<p>I wrote about this in longer form here: <a href="https:&#x2F;&#x2F;github.com&#x2F;crystal-lang&#x2F;crystal&#x2F;pull&#x2F;3328#issuecomment-247970222" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;crystal-lang&#x2F;crystal&#x2F;pull&#x2F;3328#issuecomme...</a>.
ishanjain28about 7 years ago
npm is one of the few tools that I am afraid to have on my Laptop, Because unlike most tools I have used, When npm does something wrong, It&#x27;ll ruin not just itself but a lot more directories on my pc which is annoying to fix.
dictumabout 7 years ago
Oh well, I remember fondly that one time I had an important deadline whooshing by (with that lovely sound Douglas Adams knew) and I happened across this cute little bug:<p><a href="http:&#x2F;&#x2F;appleinsider.com&#x2F;articles&#x2F;09&#x2F;10&#x2F;12&#x2F;snow_leopard_guest_account_bug_deletes_user_data" rel="nofollow">http:&#x2F;&#x2F;appleinsider.com&#x2F;articles&#x2F;09&#x2F;10&#x2F;12&#x2F;snow_leopard_guest...</a><p>(Yeah, it&#x27;s <i>that</i> much-vaunted Snow Leopard.)<p>I do remember scrambling to recover my backups. Back then, I didn&#x27;t make full-disk backups, so I had to assemble my user folder from various places. Everything else that transpired that night and the day after remains a haze.
jehlakjabout 7 years ago
Why do people feel the need to update especially on production servers? Shouldn’t production servers be updated only when necessary?
评论 #16440654 未加载
obwabout 7 years ago
I find it interesting that nobody noticed this before public release. And apparently this version is a pre-release? But that isn&#x27;t specified on the blog post?
评论 #16437811 未加载
评论 #16437717 未加载
dlandisabout 7 years ago
As a semi-outsider to the frontend and node development worlds, it continues to surprise me that a viable alternative to npm still hasn&#x27;t come along. Not trying to pile more hate on npm, but there&#x27;s been many years of complaints about instability, horrid UX, bad security model, user hostility, etc. Yarn was just a first step. If there was a system with half the features, but made sense and was secure I think the community would shift very quickly.
评论 #16441301 未加载
whatever_dudeabout 7 years ago
I swear NPM has some absurd showstopping bug every month.<p>With something that has as many people using it, it&#x27;s just... I dunno, it&#x27;s disheartening.<p>Edit: oh well, this was a @next release only. Not as bad. Still scary.
homulillyabout 7 years ago
I really wish node would ship with Yarn instead of NPM. Every serious js project these days already uses it.
评论 #16442042 未加载
coreycotoabout 7 years ago
CI&#x2F;CD does not mean deploying code to production by fetching source code from GitHub onto a server used by your customers and then compiling or downloading NPM dependencies.<p>That is a recipe for disaster.
erulabsabout 7 years ago
Looks at correct-mkdir. Sees &quot;cb = dezalgo(cb)&quot;. <a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;dezalgo" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;dezalgo</a><p>&quot;Contain async insanity so that the dark pony lord doesn&#x27;t eat souls&quot;<p>Just... What. I feel like when you need to reach for tools to &quot;contain insanity&quot;, you might want to backup and ask someone who has written to a filesystem before... The linked blog about &quot;preventing the release of Zalgo&quot; and the linked <a href="https:&#x2F;&#x2F;blog.ometer.com&#x2F;2011&#x2F;07&#x2F;24&#x2F;callbacks-synchronous-and-asynchronous&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.ometer.com&#x2F;2011&#x2F;07&#x2F;24&#x2F;callbacks-synchronous-and...</a> seem completely erroneous. The entire point of callbacks is to _surrender_ control to a function - here is a piece of code to run when you are ready - now, sometime, or never, or maybe many times, as you see fit. Waiting until the next process tick seems so completely unnecessary... This strikes me heavily as &quot;a solution in desperate search of a problem&quot; - although I have that feeling with a _lot_ of NodeJS code I read...<p>The author of the blog linked on the dezalgo project seems to, at the end of the post, imply the purpose is for performance? By deferring work until a later date?<p>&quot;The basic point here is that “async” is not some magic mustard you smear all over your API to make it fast. Asynchronous APIs do not go faster. They go slower. However, they prevent other parts of the program from having to wait for them, so overall program performance can be improved.&quot;<p>Other parts of the program _other than the work we&#x27;ve asked it to do_? What if we&#x27;re only &quot;correctly making&quot; one directory? So we intentionally make our code slower... So that &quot;other code&quot; can run? He continues:<p>&quot;This makes the API a bit trickier to use, because the caller has to know to detect the error state. If it’s very rare, then there’s a chance that they might get surprised in production the first time it fails. This is a communication problem, like most API design concerns, but if performance is critical, it may be worth the hit to avoid artificial deferrals in the common cases.&quot;<p>So it&#x27;s slower -and- more complicated, and we&#x27;re gonna hide it behind a meme. Gotcha.
评论 #16446418 未加载
_Chiefabout 7 years ago
I wish fixing of npm global directory permissions was part of the npm install page (<a href="https:&#x2F;&#x2F;docs.npmjs.com&#x2F;getting-started&#x2F;installing-node" rel="nofollow">https:&#x2F;&#x2F;docs.npmjs.com&#x2F;getting-started&#x2F;installing-node</a>), or mentioned at least. My first few npm setups always left me in permissions hell as I&#x27;d just use the install page, ignoring the next steps.
ashtonianabout 7 years ago
<a href="https:&#x2F;&#x2F;www.dayssincenpmbroke.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.dayssincenpmbroke.com&#x2F;</a><p>accepting PRs: <a href="https:&#x2F;&#x2F;github.com&#x2F;Ashtonian&#x2F;dayssincenpmbroke.com" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Ashtonian&#x2F;dayssincenpmbroke.com</a>
评论 #16445521 未加载
x2e2l2aabout 7 years ago
A user of NPM that needs to use `sudo npm` simply did not properly install nodejs into the user directory. NPM is packaged with the node version you are running. So if you installed node with a root user or in a directory that requires root user access you will need to sudo to use `npm`. But if you properly install node under your user you will never have an issue. Anyone that does `sudo npm` did not install nodejs under their user. This may be confusing to people because a lot of tutorials tell you to use `sudo npm`. NPM is a piece of software that is consumed by millions of people and different devices. It is crazy to think there will be no side effects to how people use something where it was not designed.
kuonabout 7 years ago
Running npm as root is bad, either install the npm package from your distribution (apt, pacman...) or, to use `npm install -g` edit `.npmrc` add `prefix=&#x2F;home&#x2F;&lt;me&gt;&#x2F;.node` in it, and add `~&#x2F;.node&#x2F;bin` to your path.
评论 #16440681 未加载
Sujanabout 7 years ago
Reading this and the comments here really makes me feel sorry for the npm people.<p>If you are reading this: You are doing great work, I wish you the energy and strength to ignore the trolls.
tuananhabout 7 years ago
Switching to yarn is not going to fix this. However, this raise some concern about npm cli<p>- we are relying on 2 people team for our applications. - maintainer doesn&#x27;t seem to care much about this horrific bug: <a href="https:&#x2F;&#x2F;imgur.com&#x2F;a&#x2F;v4Ndb" rel="nofollow">https:&#x2F;&#x2F;imgur.com&#x2F;a&#x2F;v4Ndb</a>
评论 #16444335 未加载
johnvegaabout 7 years ago
About a week ago, I attended a tech talk by a Google employee, a senior position, who said, if I remembered correctly, that their testing effort uses the most of their hardware resources at entire Google. Software testing can be difficult and challenging, but it is a critical part.
jxkcicickgkicuabout 7 years ago
Why would reporter run sudo npm???
评论 #16440287 未加载
Sujanabout 7 years ago
Title should be changed to 5.7.0 as newly released 5.7.1 fixes the bug.
评论 #16440150 未加载
评论 #16439817 未加载
my_gholaabout 7 years ago
I just looked at my &#x2F;usr&#x2F;lib&#x2F;node_modules directory and it&#x27;s No man&#x27;s land in there and I&#x27;m on npm 5.6.0. How could this go unnoticed for so long?
atilkanabout 7 years ago
Destroyed my local packages. Can&#x27;t resist to yarn anymore. Switched.
digi_owlabout 7 years ago
Remind me again why there are language specific package managers...