Npm seems to be broken but I can't figure out why

The system is an Arch Linux server running LAMP.

I have nodejs installed, along with npm, but when I run anything using npm, the terminal just sits there. No output. I have to force npm’s process to quit because Ctrl+C doesn’t work.

It had been working before for a while, but I did some system maintenance by moving the OS from one system to another, and after that,

The OS is a container running on a Fedora server. Moving an LXC is usually as simple as tar the directory, move, and untar. The system it was on before this one was a Fedora workstation.

I was worried updates broke it, but I uninstalled nodejs and npm then reinstalled and I still have the same issue.

Restarting the server hasn’t fixed it either. Any help is appreciated.

Npm seems to be broken but I can’t figure out why

Because it’s NPM.

You Know

1 Like

Fair, but is there a simple way to nuke->reinstall without touching other aspects of the server’s web based packages?

I figured pacman -Rs npm would be adequate, but I might be forgetting that pacman doesn’t remove config files or something?

need to clear the npm cache, completely uninstall nodejs, and nuke any residual config stuff. Try:

thought it was a fedora container?

Either way arch is not ideal for use as a reliable development environment.

Arch container on a Fedora host Server.

Containers mean snapshots are fairly easy-mode so usually this wouldn’t matter as much. I’d just roll back to a snapshot.

However, getting the container working on the Fedora 26 Server OS took time and I can’t be 100% that rolling back to the last snapshot I made would be painless, so I figured I’d get everything working again and start fresh with snapshots to go with the new host.

I agree it’s not, but for my purposes, this isn’t a production machine.

Hmm, everything this found, I deleted: find / -name *npm* after uninstall nodejs and all it’s related packages (including npm). Then cleared pacman cache.

Even npm help does nothing. Bizarre.

sounds like a rollback is gonna be easiest, considering your other option is to take a deep dive into the NPM/Node doc

Hmm, I’ll try that then. I’ll just snapshot its current state so I have a copy of files I’ve changed so I can easily keep the parts that work.

Thanks for the help.

You do know, that npm has to be run as root, right?

I’m always logged in as root since it is a container.

You know, funny thing about that. That ended up being my issue. However, it’s the opposite.

If I try to run npm as root or with sudo, it locks up as I’ve mentioned. If I run it as my normal user (who is part of the wheel group), it works fine.

I believe I ran npm as my user originally, but I can’t be sure why I ended up doing that, other than root causes it to fail.

I’ve tried it on various snapshots of my container, and all of them do it, but running npm as my regular user solves my problem in that NPM will actually respond when used, however my user lacks write access to the location I was installing npm modules, so … not sure how it’s ended up like this.


1 Like

And I’ve removed the solution because the symptoms have changed.

Now if I do npm -v, it completes but doesn’t return anything. Completes means it doesn't force me to kill the process.

I’m now attempting a reinstall of npm’s modules with npm install, but if I do this with my normal user, it gives output (i.e. a progress bar, scripts running, etc). If I do it with root, it gives nothing and it usually takes a bit, so I can’t be sure it’s not doing stuff.

I wish there were an error log for npm, but all I’ve seen is a module for errors which doesn’t help if the errors are with npm itself.

Frustrating, because I don’t know what changed to let basic commands complete without output.

This sounds really ball-busting man, I feel for you. I’m so glad I’ve never had to deal with any complex node stuff in production.

When did frontend and js get so busted man? What was so wrong with jquery? Where did we go wrong? Do we deserve this? Were our sins so great?

out of curiosity what do you need to run in node?

1 Like

Well, I want AJAX auto-updating tables. Meaning, no page refreshes are necessary for tables to show new information.

See this thread:

The J in AJAX is JavaScript, and I’m also using Laravel PHP framework in building the website.

I’m glad you asked that question though, because the reason I was using NodeJS is because that’s what the tutorial I was following to learn Laravel’s basics used. Now that I look for alternatives, I find this page:

WebSockets is useful for “when to get new data”, but it doesn’t handle the partial page refresh aspect.

Basically his answer.

I may try redoing this from scratch in a separate Linux Container and see if it breaks that way.

May be worthwhile. Can’t get any more busted than your current container lol

1 Like

dude, if you want to use websockets then just use MeteorJS. Comes prebuilt with nodejs internally as well.

Also, if you need help with understanding Meteor I’ve got a pretty decent grasp of it.


Nothing is wrong with Jquery per se. Things still use jquery in modern frameworks, but have shifted very fast.

Nothings wrong, its just the evolution of the language.

Saying nothing’s wrong with the current state of JS is wholly inaccurate by any metric.

Not saying it’s useless; far from it – but that shit needs maturity and people that aren’t hobbyists writing all the extensions and frameworks.

So what, you mean like typescript being the future?

Mainly the fragmentation, ridiculous dependencies and configuration requirements, and rube-goldbergian nature of everything in frontend right now.

The joke is often “JS is an acronym for Job Security” because there’s no clean method for anything and best practices and standards either don’t exist or just plain aren’t followed by the majority of people depending on what you’re trying to build. It’s often easier to keep a shitty JS employee than try and find someone who can decipher their spaghetticode.

Nothing more nightmarish than trying to work out how the last guy got all his JS duct taped together and somehow functional. There’s a new esoteric framework with unique gotchas and incompatibilities made every day, and these trends are only accelerating.

Well, as long as a place uses React, React Native, Vue, Angular or Meteor; then it can’t be so bad. A lot less custom spaghetti code.

Most MVW framworks/libraries really just have Node as a dependency, or bake their own. Elaborate on this please?

agreed. Though, I’m not a professional dev so I haven’t experienced this first hand.