You are not logged in.
I want to install npm (and maybe other package managers in the near future). I understand that this might conflict with pacman. I want to know what I need to be mindful about and what steps I will need to take before and after installing a foreign package manager.
Offline
I'd say just don't use them at all. Anything available to third party package managers are either A) already in the repos, B) in the AUR, or C) could easily be properly packaged.
But if you do chose to use other package managers, do not run them as root (and thus use them to install only locally to your user's home directory).
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
1. avoid it
2. avoid it
3. avoid it
4. don't use them in global paths (as root)
5. they can adjust your environment to prefer the local installation paths what can lead to unexpected behavior in completely unrelated clients:
https://bbs.archlinux.org/viewtopic.php?id=298750
https://bbs.archlinux.org/viewtopic.php?id=299449
tl;dr If you can't avoid it, be very mindful of what those tools actually do - wheher they spill into /usr (very bad, basically unmanageable) or pollute your environment (you need to be aware and in control of it) or come up with new and innovative ways to make your life hard.
Offline
The reason I wanted to install npm is so that I can learn web development. If npm is not an option, how do I go about this?
Offline
What does npm have to do w/ "web development"?
npm shovels javascript packages onto your system - as mentioned by Trilby, you'll find many of them in the AUR anyway.
Offline
I have zero experience with npm, but whenever I wanted to try something that might adversely interfere with my main installation, I resort to using containers/virtualization to shield it.
When I first started using linux, I relied heavily on virtualbox, then migrated to qemu/kvm. Nowadays I use systemd-nspawn. Docker is also a possibility but I never tried it.
Never argue with an idiot, they will drag you down to their level and then beat you with experience.
It is better to light a candle than curse the darkness.
A journey of a thousand miles begins with a single step.
Online
What does npm have to do w/ "web development"?
npm shovels javascript packages onto your system - as mentioned by Trilby, you'll find many of them in the AUR anyway.
I'm just trying to follow a particular course.
What would be the pacman equivalent for this command?
npm create vite@latest my-vue-app -- --template vue
Last edited by ThoughtBubble (2024-10-21 15:55:30)
Offline
What would be the pacman equivalent for this command?
npm create vite@latest my-vue-app -- --template vue
This is perfectly fine to run,this will just init a new vue app and won't interfere with your arch packages.
Just avoid using npm install -g or --global etc ( or configure npm to install global packages in a folder your user owns if you really need to do it. )
Offline
Is there a way I can block that specific command only when the global option is provided? Is there a way to restrict the "npm i" command such that it would only run within a specific directory?
Last edited by ThoughtBubble (2024-10-21 18:05:24)
Offline
If you're not running npm as root, it won't be able to install anything globally.
Simply don't type stuff blindly into an interactive shell, no matter what it is. Always try to understand what's that gonna do first.
Offline
Is someone else entering commands on your machine? If you don't want to use the -g / --global flag, then just don't use it. As seth notes, these options would require root access, so that's a layer of safety, but other than that are you asking for a way to prevent yourself from entering a command that you don't want to enter?? If so, I'd recommend the low tech solution.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
In my experience a time ago, if you use the installation without global mode you will be fine. The packages will be installed in your project only and not in your system. Then you can setup the json config file to your needs, for example if you want to omit something. I worked with angular also and with nodejs with npm an i had zero times breaking the system in my project. Yes full js backend also with express js. Hope it helps you with your project.
Last edited by Succulent of your garden (2024-10-21 22:44:31)
Offline