Created
September 14, 2017 19:12
-
-
Save dryliketoast/a0e62beea0521e2ff57cbf60955b6229 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://stackoverflow.com/questions/14914715/express-js-no-such-file-or-directory#14914716 | |
| There are two package in Ubuntu that have similar names, node and nodejs. | |
| node does this, | |
| Description-en: Amateur Packet Radio Node program. The node program accepts TCP/IP and packet radio network connections and presents users with an interface that allows them to make gateway connections to remote hosts using a variety of amateur radio protocols. | |
| nodejs does this, | |
| Description-en: Node.js event-based server-side javascript engine Node.js is similar in design to and influenced by systems like Ruby's Event Machine or Python's Twisted. It takes the event model a bit further - it presents the event loop as a language construct instead of as a library. Node.js is bundled with several useful libraries to handle server tasks : System, Events, Standard I/O, Modules, Timers, Child Processes, POSIX, HTTP, Multipart Parsing, TCP, DNS, Assert, Path, URL, Query Strings. | |
| Fedora also follows a similar package naming scheme. Because of this, the binary in nodejs had to be renamed to nodejs from the original node. However, this isn't technically kosher: and most nodejs programs (and libraries installed with npm) assume that the node binary is node. If you want to get around this the easiest way is just symlink the two together. If you take this route, don't install the node package which handles the Amateur Packet Radio stuff. | |
| sudo ln -s /usr/bin/nodejs /usr/local/bin/node | |
| Alternatively, in the case of node, I'd suggest using n and not installing node. Just install npm (which will install node), then remove npm, then tell apt to clean it up. To do this, simply run | |
| sudo apt-get install npm | |
| sudo npm install -g n | |
| sudo n latest | |
| sudo apt-get --purge remove npm | |
| sudo apt-get autoremove | |
| There are other binary distro managers that even work from a shell script like nvm but I personally prefer n. Think of n like an apt for just one thing: the node binary which it installs to /usr/local/bin. | |
| Why are removing npm? We're not. apt-get --purge remove can only ever remove things installed by the package manager. n latest works outside of the package manager. There are two npms if you do this, | |
| version installed by the distro (Debian/Ubuntu) using apt-get. | |
| version installed by n latest. | |
| No point in having the distro's older version. And, even worse, if that version works it can potentially install to a different location and have Debian modifications in it that assume Debian install directories. It's better to use either/or but not both. | |
| good explanation. this is one of the dumbest bugs i've ever encountered... aren't the package maintainers supposed to make sure stuff like this doesn't happen?? – parker.sikand Mar 26 '13 at 18:14 | |
| No, you can only have one binary with the name of node with any reasonable package manager, however a reasonable distro would realize that inconveniencing many people because of a package last bugfixed a decade ago, make no sense. This is a repeat of git, vs git-core. – Evan Carroll Mar 26 '13 at 18:23 | |
| I'm a little confused by this, why do you remove npm at the end? Isn't it needed still? – Jens Bodal Feb 1 '16 at 22:18 | |
| @JensBodal I was wondering the same thing. But i noticed that my npm got updated not removed ultimately. I ran all the commands mentioned in this answer. – user2407334 Feb 12 at 19:51 | |
| Updated with the answer @JensBodal – Evan Carroll Feb 12 at 19:54 | |
| In my case it was because in my PATH environment variable, I had "~/progs/node/bin/" and the "~" does not seem to be resolved by env... replacing it with the real full path ("/home/myuser/node/bin") solved my problem. | |
| share|improve this answer | |
| answered Mar 13 '13 at 22:35 | |
| Anthony O. | |
| 6,03144495 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment