Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 637 Vote(s) - 3.44 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Express.js: No Such file or directory

#1
I installed node with `apt-get install nodejs`. Then I installed npm with `apt-get install npm`. Now when I try to run `express` I get

$ express
/usr/bin/env: node: No such file or directory

How do I resolve this error?
Reply

#2
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.
Reply

#3
do this in cmd

sudo apt-get install nodejs-legacy
chmod your folder 700 (optional)

Reply

#4
This solution

export PATH="$HOME/opt/nodejs/bin:$PATH"

resolved this issue for me (it should work assuming the $HOME variable is set properly). It also allows me to avoid hard coding the path to my home directory (for example so I can reuse my .bash_profile with different accounts/servers if I need to)
Reply

#5
you should install nodejs-legacy package which have a link from /usr/bin/node to /usr/bin/nodejs

```$ sudo apt-get install nodejs-legacy```
Reply

#6
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`](

[To see links please register here]

) 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,

1. version installed by the distro (Debian/Ubuntu) using `apt-get`.
2. 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.
Reply

#7
**Disclaimer: only for bash command running via deployment tools**

**Note:** In remote server, if you can run node command but via deployment tool like shipit server throws like ``/usr/bin/env: ‘node’: No such file or directory``. Creating symlink will resolve errors.

```bash command
sudo ln -s $(which node) /usr/bin/node
sudo ln -s $(which npm) /usr/bin/npm
sudo ln -s $(which pm2) /usr/bin/pm2
```
Reply



Forum Jump:


Users browsing this thread:
2 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through