The tragedy of running an old Node project
Abdisalan Mohamud faced challenges running an old Node.js project after four years, including installation errors and compatibility issues. Reverting to Node version 12.2 resolved the problems, taking two hours.
Read original articleAbdisalan Mohamud recounts his experience of trying to run an old Node.js project after nearly four years of inactivity. Initially, he faced numerous errors during the installation process, including a requirement for Python 2, which he found unnecessary for a Node package. After successfully installing Python 2, he encountered further complications related to C++ code and compatibility issues with his current version of Node.js. He realized that he did not specify the Node version in his project's package.json file, making it difficult to determine the correct version used previously. After extensive searching and troubleshooting, he discovered that reverting to Node version 12.2 resolved the issues, allowing him to continue with his blog site. The entire process took him two hours, highlighting the challenges of maintaining older software projects.
- Running old Node.js projects can lead to unexpected dependency issues.
- Compatibility with Python and C++ can complicate the installation of Node packages.
- Specifying the Node version in package.json is crucial for project maintenance.
- Troubleshooting legacy projects can be time-consuming and frustrating.
- Keeping software dependencies updated is important to avoid conflicts.
Related
NPM and NodeJS should do more to make ES Modules easy to use
Boris Cherny discusses challenges with ES Modules in NodeJS and NPM, proposing solutions like simplifying file extensions, upgrading libraries, and phasing out CommonJS support in NodeJS to boost adoption rates.
Node 18 Ate My Website
The author upgraded their Next.js website to Node.js 18, facing issues with deprecated dependencies. They rebuilt the site with TypeScript, Contentlayer, Tailwind CSS, and Vercel Analytics, emphasizing simplicity and emerging technologies.
Node.js Is Here to Stay
Node.js, a key technology for 15 years, powers 6.3 million sites and 98% of Fortune 500 companies. Its lightweight, event-driven design suits real-time and high-concurrency needs. Security updates, Linux preference, and new features like ECMAScript Modules ensure Node.js remains a versatile and secure tool for modern web development.
Ask HN: Pragmatic way to avoid supply chain attacks as a developer
The article addresses the security risks of managing software dependencies, highlighting a specific incident of a compromised package. It debates the effectiveness of containers versus VMs and seeks practical solutions.
Thoughts on the Resiliency of Web Projects
Aaron Parecki discusses the challenges of maintaining web projects, advocating for static HTML over dynamic sites, questioning new project necessity, and emphasizing simplicity and sustainability in web development.
- Many users experience "node rot," where outdated dependencies and compatibility issues arise after a period of inactivity.
- There is a consensus that specifying Node.js versions and using tools like Docker can mitigate these issues.
- Comments highlight the problematic nature of native dependencies, particularly those requiring node-gyp, which complicate project maintenance.
- Several users express that similar issues occur across various programming languages and frameworks, not just Node.js.
- Some commenters suggest that better practices, such as using package-lock files and maintaining clear documentation, could alleviate future problems.
> Two hours of my life gone...
Two hours of work after 4 years sounds ... perfectly acceptable?
And it would have run perfectly right away if the node version was specified, so a good learning, too
This feels like making a mountain out of a mole hill
If I had only wasted two hours every time I had to use npm for some reason I'd be significantly ahead of where I am now.
My favorite is the way that Python projects rot. Not only does Python's setuptools give you all the fun that node-gyp does, the common practice of versioning packages with packagename>=1.25.5 means you're almost guaranteed breakages as pip installs newer versions of packages than what the project was built with.
On the flip side, anything that uses vanilla JS without a build will most likely run just fine, probably till the end of human civilization.
Go is much, much better on these terms, although not perfect.
I’d venture a guess that Perl 5 is outstanding here, although it’s been a few years since I tried to run an old Perl project. CPAN was dog slow, but other than that, everything worked first try.
I’d also bet Tcl is nearly perfect on the ‘try this 10 year old repo’ test
In the JS ecosystem, I'm aware that Meteor is one major framework that takes backwards-compatibility seriously. Updating a project on an ancient version to a less-ancient version usually is not too hard. They try to keep APIs the same and introduce compatibility packages where possible.
Meteor 2.16 to Meteor 3 introduced major breaking changes due to an underlying technical issue that had no workaround. They had to refactor the whole project from using Fibers-based concurrency to typical async/await.
node-gyp in general has also been a source of issues in the past for me as well.
More recently, ESLint changed their configuration file format and all existing tutorials suddenly became outdated.
I firmly believe the ecosystem does not have to be like this, and we would save a lot of man-hours by being more committed to API stability where possible.
If you must depend on node-gyp, perhaps use dev containers so at least every developer in your team can work most of the time.
Hopefully the ecosystem as improved since then, but it was nearly impossible to get going.
Some packages had been changed and the version number overwritten with incompatible packages, and the conflicts were plenty.
Node is an active project. If you build against the native API and don't pin your version to avoid breaking changes between versions, this is what happens. In my experience, JS very rarely breaks between major Node versions, but almost every native package requires a new major update.
This isn't a Node specific problem. Go ahead and upgrade your Go or Python version.
Since it's just a binary though, I wound up grabbing the OpenSSL from the old box and patching the binary to just point to that instead. Thing runs fine after that.
This is all, of course, still totally stupid - but I did find myself thinking how much worse comparable events in JS have been for me over the years. What would have been easily an entire afternoon ended up taking 15 minutes - and a chunk of that was just double checking commands I'd long forgotten.
That way, the project has just the dependencies it needs, and I know I can rebuild it at some point in the future and will be unlikely to run into problems when I do.
When I was managing teams, whatever the language, I would ban any new dependencies which I didn't personally agree with. A lack of control just creates a nightmare.
It is systemic. Part of it is due to too many people creating systems on the fly with too little forethought, but also because there aren't enough "really smart people" working on long term solutions. Just hacks, done by hacks. What did you expect when the people writing the systems don't have long term experience?
I had a similar experience with emberJS when it was still young. Every time I picked the project up I had one to two hours of upgrade work to get it to run again, and I just had a couple hours to work on it. So half my time went to maintenance and it wasn’t sustainable.
I’m trying a related idea now in elixir and José may be a saint. Though I fear a Java 5 moment in their future, where the levee breaks and a flood of changes come at once.
If Nix is too heavy, the learning curve for tools like asdf-vm and mise is much lower and offers similar benefits.
I really wish there was a good equivalent for Windows.
Beat SSG I've found, and all from a medium or dev article on a SSG in 40 lines or less.
- bump patch or minor version from a react package but the maintainer rewrote the entire project breaking a lot of things, following semver it's bad to expect things don't break like that for such version; - another example, the ruby gem is removed/yanked from rubygems.org and you'd to find a fork available
On the end, we need to ensure the good practices from software engineering about tests and good release management, the last btw is decades old
If upgrading is difficult because of 4 years of breaking changes, blame Gatsby for not being backwards compatible. Also blame your original choice of going with a hokey framework.
Speaking of hokey framework: 167 dependencies and 3000 versions of Gatsby in npm.
"Not Invented Here" is whats going on. Developers of this age need to learn this.
A recent exmaple is the RPI Foundation nullifying thousands of internet tutorials renaming "/boot" vs "/bootfs". Ask yourself a serious question, did that actually improve anything? No it did not.
for the latter i get around the problem by avoiding build tools altogether. i use a frontend framework that i can load directly into the browser, and use without needing any tools to manage dependencies. the benefit from that is that it will ensure that my site will keep running for years to come, even if i leave it dormant for some time. the downside is that it is probably less optimized. but for smaller sites that aren't under continuous maintenance this is a reasonable tradeoff. i built all my recent sites that way using a prebuilt version of the aurelia framework.
incidentally just today i tried to research if i could build a site with svelte that way. well, it turns out that although it should theoretically be possible, i was unable to find a prebuilt version to do so after a few hours of searching. for vuejs i found one within minutes. i'll be learning vuejs now.
see this thread for a discussion on going buildless: https://news.ycombinator.com/item?id=41479365
We're in ... let's call it a transitional period at work. I've got something like a dozen versions of node being managed by asdf. And in half of the projects I work on regularly, I consistently get warnings about this particular project failing to build.
One day, I'll actually look up what it actually is, and what it does, and why it's being built, but is apparently optional.
Fortunately this mindset has been changing in the node ecosystem with projects like https://hono.dev/ (koa/express successor) and https://github.com/porsager/postgres having zero deps.
Anyways, npm ci should have been the first attempt, not npm install so that it installs the same package versions defined in the package-lock.json. Then as others have mentioned, pin your node versions. If you're afraid of this happening again, npm pack is your friend.
In the end, op could have done a bit more. BUT I'll give it to him that when bindings are involved, these things take more time than they should
Gave up.
Then I ran `devbox init` and installed whatever it told me that was needed. `devbox shell`.
https://medium.com/hackernoon/how-it-feels-to-learn-javascri... (beware the green background, I recommend reader mode.)
"go mod init" + identify a working dependency version was all I had to do on any of those 10+ year old projects (5 minute work tops)
https://dubroy.com/blog/cold-blooded-software/
Sibling comments say in so many words, it's no big deal bro, just update. But it is a big deal over time if you have dozens of cold-blooded projects to deal with.
Also, do not run shit on a node version that is years out of date and out of service. Also, update your damn packages. I know I sound cranky, but running anything internet facing with god knows how many vulnerabilities in is an exceedingly bad idea.
Experienced programmers will not pick up a "built on shifting sand" stack, because they can acutely perceive the pain and suffering before it happens, generally from past experience. With fast-crumbling stacks, you need to execute quickly and move on, and treat the whole codebase as an expiring entity. Stacks I personally try to avoid: anything node/javascripty, anything Androidy, anything iDevicey.
Those who don't understand Unix are condemned to reinvent it, poorly. - Henry Spencer
Related
NPM and NodeJS should do more to make ES Modules easy to use
Boris Cherny discusses challenges with ES Modules in NodeJS and NPM, proposing solutions like simplifying file extensions, upgrading libraries, and phasing out CommonJS support in NodeJS to boost adoption rates.
Node 18 Ate My Website
The author upgraded their Next.js website to Node.js 18, facing issues with deprecated dependencies. They rebuilt the site with TypeScript, Contentlayer, Tailwind CSS, and Vercel Analytics, emphasizing simplicity and emerging technologies.
Node.js Is Here to Stay
Node.js, a key technology for 15 years, powers 6.3 million sites and 98% of Fortune 500 companies. Its lightweight, event-driven design suits real-time and high-concurrency needs. Security updates, Linux preference, and new features like ECMAScript Modules ensure Node.js remains a versatile and secure tool for modern web development.
Ask HN: Pragmatic way to avoid supply chain attacks as a developer
The article addresses the security risks of managing software dependencies, highlighting a specific incident of a compromised package. It debates the effectiveness of containers versus VMs and seeks practical solutions.
Thoughts on the Resiliency of Web Projects
Aaron Parecki discusses the challenges of maintaining web projects, advocating for static HTML over dynamic sites, questioning new project necessity, and emphasizing simplicity and sustainability in web development.