-
-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usr/bin/env: node: No such file or directory #786
Comments
I'm not sure what there is to fix. Nvm by design doesn't install anything in your system globally. Any tool looking for a globally installed node won't find the nvm version. You can create a symlink like is suggested in the sindresorhus/sublime-autoprefixer issue. You'll need to update this symlink if you want to switch global node versions. |
Also |
In my case I've added nvm to my path, but haozi@kingder:~$ echo $PATH
/home/haozi/.nvm/v0.10.25/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games |
At least this pitfall should be noted on README. It seems to many people no clue about what's wrong. especially when today most node libraries' error reporting is poor. |
Are you sure Try running it directly from the same session where you printed env node That should drop you into a node repl. Also try |
haozi@kingder:~/words$ echo $PATH
/home/haozi/.nvm/v0.10.25/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
haozi@kingder:~/words$ sudo slc run
/usr/bin/env: node: No such file or directory |
I'll bet |
Also see #43 as mentioned in the main README about |
Yeah! I think you are right. haozi@kingder:~/words$ sudo env node
env: node: No such file or directory |
Why are you using |
@ljharb I never |
@wangzhihao right, that's my question. |
@ljharb then what should I do if I want to run node in root privilege? For example, I try to start an express server in default 80 port, which requires root to operate. |
You definitely don't want to do that, for a number of reasons - but if you want to run node as user X, then you must install nvm and node all under user X. |
What's the reasons? I'm curious : ) |
Primarily security - a node program with root privileges can do anything it wants to on your system, and it's unlikely that "everything" is actually the privileges that the program truly needs. It's best to be as granular as possible about these things. Namely, while it could be malicious code in node core or in any of your dependent modules, it's more likely that a bug exists in node core, or in any of your dependent modules - and an accidental |
Okay, I got it. I will try the nginx as a reverse proxy, as told by the suggestion here. Thanks for pointing it out. |
Try this: ln -s /usr/bin/nodejs /usr/bin/node |
@KevinMcSun that definitely isn't a good idea; nobody calls it "nodejs" but Ubuntu, and it'd be better to correct your PATH rather than try to hack around it. |
@wangzhihao fwiw, I think it's fine to run node as root on your local machine if you just want to test binding to port 80. You'll probably need to install nvm for root for it to work though. Nvm was originally a development tool. I've seen people use it for production deployments as well. My personal practice is to hard-code the path to the node version I want in my upstart/systemd/initd script and skip nvm for production environments. |
Alternatively, you could use authbind which works both locally and in production. |
Just for future reference, I was trying to run sails-inverse-model over nvm at v9.6.1 and only managed to work using full script path like: |
@marcosrocha85 the idea is that you wouldn’t use sudo at all, and would run |
@ljharb in my case I was running sails-inverse-model and I only managed to run that way. I don't know if the script itself has compatibility issues with nvm. |
There is not enough explanation in the documentation about where nvm is installing node, and what paths are or are not set. It's not a feature to have a lack of documentation. |
@Kielan that’s not info that should really be needed by anyone; everything goes in $NVM_DIR, and changing the PATH is the only way anything could be runnable on the command line (either per version, or once with a shim). What more explanation in the docs would you expect? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Why does nvm automatically don't make ls for node and add it to PATH after |
@ezalivadnyi i'm not sure what you're asking. |
If node works in command line but not vscode then try this.. "which node" in command line to check what directory u have it installed in.. |
@ljharb I think he's asking if it would be possible to have nvm use ... create the link in /usr/bin as opposed to having to recreate this link whenever you use a different version. |
@Nodiril Creating a symlink doesn't make much sense, because |
@ljharb After finding an example I understand what you're saying. Node version should be set at the project level. The reason I ended up here was when trying to debug in vscode I ended up with:
So I'm trying to understand what the cause is and I thought it may be because I'm using nvm instead of having node installed. When executing /usr/bin/bash -c 'tsc -p tsconfig.json' from the terminal, it executes properly. |
vscode ships its own copy of node, bundled. |
In my case the NVM export in my |
This is quite weird. can anyone fix it?
sindresorhus/sublime-autoprefixer#50
http://stackoverflow.com/questions/20886217/browserify-error-usr-bin-env-node-no-such-file-or-directory
The text was updated successfully, but these errors were encountered: