2
Wittner
3y

Here's a fucking brilliant idea:
apt-get install nodejs should download and install node latest version. This would be instead of having 18 fucking tabs open and reading through masses of stackoverflow answers for 18 months and typing thousands of instructions in the terminal and learning to fucking HATE node to install the latest version of node. Radical, I know.

Comments
  • 1
    Replace apt with pacman and you have what you want.
  • 2
    If you want new software use a rolling-release distro. Simple as that.

    Alternatively you could do some Docker magic where you can have any package in any version in a clean environment, but if you know how to do that you don't have this problem in the first place.
  • 4
    Use nvm. It's becoming a bit of a trend where new langs come out with a language version manager. Haskell (hcup), rust(rustup), golang(go get <version>.. etc

    Nvm is purely a bash script, so it runs almost anywhere, plus it uses a non-global self-contained installation directory for everything(Usually ~/.nvm/)
  • 0
    Nvm or/and docker, as any local thing should run, especially node
  • 0
    Apt install or brew install nvm. That does all of that versioning work for you.
  • 0
    @irene found out the repos that come with Ubuntu at least doesn't have the latest version of node. You have to install their own apt repo. Not unreasonable but OP was bitching about apt for this reason.
  • 0
    @demortes nvm is better. It gives you a node version manager that does all the node source management for you.

    I think you can apt install it? Then you can use whatever version of node you need at the moment. I use versions 10-16 for work since other teams haven’t updated.

    https://github.com/nvm-sh/nvm
  • 0
    @irene there's something fundamentally wrong when you need a version manager.

    I need to dog into it more but I can't even run jest right now. Randomly failing test suites. Only my computer though, not other devs. Frustrating. Relates because part of it is, 8 wonder, version differences of global angular cli and supporting packages vs locally installed (even after uninstalling all global items). Node and angular just does not sit well with me right now. I'll stick with .NET.
  • 0
    @demortes Yeah, I have to work on some Node projects and nowadays I only run them in containers. Much less frustrating, and easier to setup on a different machine.

    And it prevents that funny bug causing npm to throw a weird error if it can't find a dependency and you have Steam installed. Such a pile of garbage.
  • 0
    @deadlyRants why the fuck should npm have an problem with steam?!
  • 1
    @stop The totally stable geniuses behind npm decided it would be a good idea that when a dependency is missing, npm should recursively search all parent directories until it either found the dependency or searched everything.

    Now Steam installs an intentionally broken link for some compatibility reason. And npm can't handle that something prevents it from searching every fucking file on the computer including the hidden ones. So as a result it shits itself, throws a generic "file not found" error with a Steam-related file path and you sit there and have no fucking clue what just happened, when actually it just didn't find a dependency.

    And as Docker containers usually don't have Steam installed, npm won't act like some ADHD kid and properly report the correct error.
  • 0
    @demortes @deadlyRants

    Visual Studio has had “which version of dotnet do you wanna use”. People used to gripe about not being able to switch between Java version 7, 8, and 9 about a decade ago. A command line version manager isn’t symptomatic of some kind of problem, it addresses a need to switch runtimes and libraries. This is a problem for python devs that live with the old version of python bundled with MacOS. This is a huge problem for people that have to maintain old VB.Net apps. This isn’t a new development problem and certainly isn’t limited to Node.js.

    Steam is probably using the global installation of node. So dependencies land in /usr/local/bin or something. If that version is broken but it will break if you change it don’t use it. Nvm manages node in ~/.nvm and uses aliases to keep it in user land. Each version of node has its own binary. Each binary has its own paired version of NPM. Nvm is very elegant in comparison to venv management on other runtimes.
  • 0
    @deadlyRants Do you have a package.json in your project root? I've never heard of this problem before.
  • 0
    @deadlyRants i searrch my pc and the are a few package.json files, but the all belong to a game.
  • 0
    @AvyChanna Of course. How else would npm know what package to search for?
Add Comment