env: node: No such file or directory - node.js

env: node: No such file or directory
I checked if my directory for node wasn't wrong and it's fine.
I tried these following answers already:
1. https://github.com/nodejs/node-v0.x-archive/issues/3911
2. https://github.com/creationix/nvm/issues/1702
3. browserify error /usr/bin/env: node: No such file or directory
USER-no-MacBook-Pro-2:nomadcoin user$ yarn init
env: node: No such file or directory
USER-no-MacBook-Pro-2:nomadcoin user$ brew install node
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
acpica fantom lego qmmp
bat fn libdca rubberband
bazel fselect libpqxx ruby-build
cake fstar nativefier saxon
calabash groovysdk openimageio shellcheck
cdrdao h2o pegtl sqlmap
cmake hadoop percona-server teleport
conan heroku phpunit urh
convox jenkins-job-builder pike
etcd jetty ponyc
exomizer jetty-runner pygobject3
Warning: node 10.3.0 is already installed, it's just not linked
You can use `brew link node` to link this version.
USER-no-MacBook-Pro-2:nomadcoin user$ brew link node
Linking /usr/local/Cellar/node/10.3.0...
Error: Could not symlink include/node/android-ifaddrs.h
Target /usr/local/include/node/android-ifaddrs.h
already exists. You may want to remove it:
rm '/usr/local/include/node/android-ifaddrs.h'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite --dry-run node
USER-no-MacBook-Pro-2:nomadcoin user$ brew link --overwrite --dry-run node
Would remove:
/usr/local/include/node/android-ifaddrs.h
/usr/local/include/node/common.gypi
/usr/local/include/node/config.gypi
/usr/local/include/node/libplatform/libplatform-export.h
/usr/local/include/node/libplatform/libplatform.h
/usr/local/include/node/libplatform/v8-tracing.h
/usr/local/include/node/node.h
/usr/local/include/node/node_api.h
/usr/local/include/node/node_api_types.h
/usr/local/include/node/node_buffer.h
/usr/local/include/node/node_object_wrap.h
/usr/local/include/node/node_version.h
/usr/local/include/node/openssl/aes.h
/usr/local/include/node/openssl/asn1.h
/usr/local/include/node/openssl/asn1_mac.h
/usr/local/include/node/openssl/asn1t.h
/usr/local/include/node/openssl/bio.h
/usr/local/include/node/openssl/blowfish.h
/usr/local/include/node/openssl/bn.h
/usr/local/include/node/openssl/buffer.h
/usr/local/include/node/openssl/camellia.h
/usr/local/include/node/openssl/cast.h
/usr/local/include/node/openssl/cmac.h
/usr/local/include/node/openssl/cms.h
/usr/local/include/node/openssl/comp.h
/usr/local/include/node/openssl/conf.h
/usr/local/include/node/openssl/conf_api.h
/usr/local/include/node/openssl/crypto.h
/usr/local/include/node/openssl/des.h
/usr/local/include/node/openssl/dh.h
/usr/local/include/node/openssl/dsa.h
/usr/local/include/node/openssl/dtls1.h
/usr/local/include/node/openssl/e_os2.h
/usr/local/include/node/openssl/ebcdic.h
/usr/local/include/node/openssl/ec.h
/usr/local/include/node/openssl/ecdh.h
/usr/local/include/node/openssl/ecdsa.h
/usr/local/include/node/openssl/engine.h
/usr/local/include/node/openssl/err.h
/usr/local/include/node/openssl/evp.h
/usr/local/include/node/openssl/hmac.h
/usr/local/include/node/openssl/idea.h
/usr/local/include/node/openssl/lhash.h
/usr/local/include/node/openssl/md4.h
/usr/local/include/node/openssl/md5.h
/usr/local/include/node/openssl/mdc2.h
/usr/local/include/node/openssl/modes.h
/usr/local/include/node/openssl/obj_mac.h
/usr/local/include/node/openssl/objects.h
/usr/local/include/node/openssl/ocsp.h
/usr/local/include/node/openssl/opensslconf.h
/usr/local/include/node/openssl/opensslv.h
/usr/local/include/node/openssl/ossl_typ.h
/usr/local/include/node/openssl/pem.h
/usr/local/include/node/openssl/pem2.h
/usr/local/include/node/openssl/pkcs12.h
/usr/local/include/node/openssl/pkcs7.h
/usr/local/include/node/openssl/rand.h
/usr/local/include/node/openssl/rc2.h
/usr/local/include/node/openssl/rc4.h
/usr/local/include/node/openssl/ripemd.h
/usr/local/include/node/openssl/rsa.h
/usr/local/include/node/openssl/safestack.h
/usr/local/include/node/openssl/seed.h
/usr/local/include/node/openssl/sha.h
/usr/local/include/node/openssl/srp.h
/usr/local/include/node/openssl/srtp.h
/usr/local/include/node/openssl/ssl.h
/usr/local/include/node/openssl/ssl2.h
/usr/local/include/node/openssl/ssl3.h
/usr/local/include/node/openssl/stack.h
/usr/local/include/node/openssl/symhacks.h
/usr/local/include/node/openssl/tls1.h
/usr/local/include/node/openssl/ts.h
/usr/local/include/node/openssl/txt_db.h
/usr/local/include/node/openssl/ui.h
/usr/local/include/node/openssl/whrlpool.h
/usr/local/include/node/openssl/x509.h
/usr/local/include/node/openssl/x509_vfy.h
/usr/local/include/node/openssl/x509v3.h
/usr/local/include/node/pthread-barrier.h
/usr/local/include/node/stdint-msvc2008.h
/usr/local/include/node/tree.h
/usr/local/include/node/uv-aix.h
/usr/local/include/node/uv-bsd.h
/usr/local/include/node/uv-darwin.h
/usr/local/include/node/uv-errno.h
/usr/local/include/node/uv-linux.h
/usr/local/include/node/uv-os390.h
/usr/local/include/node/uv-posix.h
/usr/local/include/node/uv-sunos.h
/usr/local/include/node/uv-threadpool.h
/usr/local/include/node/uv-unix.h
/usr/local/include/node/uv-version.h
/usr/local/include/node/uv-win.h
/usr/local/include/node/uv.h
/usr/local/include/node/v8-inspector-protocol.h
/usr/local/include/node/v8-inspector.h
/usr/local/include/node/v8-platform.h
/usr/local/include/node/v8-profiler.h
/usr/local/include/node/v8-testing.h
/usr/local/include/node/v8-util.h
/usr/local/include/node/v8-value-serializer-version.h
/usr/local/include/node/v8-version-string.h
/usr/local/include/node/v8-version.h
/usr/local/include/node/v8.h
/usr/local/include/node/v8config.h
/usr/local/include/node/zconf.h
/usr/local/include/node/zlib.h
/usr/local/share/doc/node/gdbinit
/usr/local/share/doc/node/lldb_commands.py
/usr/local/share/doc/node/lldbinit
/usr/local/share/man/man1/node.1
/usr/local/share/systemtap/tapset/node.stp
/usr/local/lib/dtrace/node.d
USER-no-MacBook-Pro-2:nomadcoin user$ brew link node
Linking /usr/local/Cellar/node/10.3.0...
Error: Could not symlink include/node/android-ifaddrs.h
Target /usr/local/include/node/android-ifaddrs.h
already exists. You may want to remove it:
rm '/usr/local/include/node/android-ifaddrs.h'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite --dry-run node
USER-no-MacBook-Pro-2:nomadcoin user$ run node
bash: run: command not found
USER-no-MacBook-Pro-2:nomadcoin user$ brew install node --force
Warning: node 10.3.0 is already installed, it's just not linked
You can use `brew link node` to link this version.
USER-no-MacBook-Pro-2:nomadcoin user$ brew install node --rf
Warning: node 10.3.0 is already installed, it's just not linked
You can use `brew link node` to link this version.
USER-no-MacBook-Pro-2:nomadcoin user$ brew install -rf node
Warning: node 10.3.0 is already installed, it's just not linked
You can use `brew link node` to link this version.
USER-no-MacBook-Pro-2:nomadcoin user$ node install yarn
bash: node: command not found
USER-no-MacBook-Pro-2:nomadcoin user$ npm install yarn
env: node: No such file or directory
USER-no-MacBook-Pro-2:nomadcoin user$ brew install yarn -g
Warning: yarn 1.7.0 is already installed and up-to-date
To reinstall 1.7.0, run `brew reinstall yarn`
USER-no-MacBook-Pro-2:nomadcoin user$ brew reinstall yarn
==> Reinstalling yarn
==> Downloading https://yarnpkg.com/downloads/1.7.0/yarn-v1.7.0.tar.gz
Already downloaded: /Users/user/Library/Caches/Homebrew/yarn-1.7.0.tar.gz
🍺 /usr/local/Cellar/yarn/1.7.0: 14 files, 4.2MB, built in 1 second
USER-no-MacBook-Pro-2:nomadcoin user$ yarn install
env: node: No such file or directory
USER-no-MacBook-Pro-2:nomadcoin user$ yarn init
env: node: No such file or directory
USER-no-MacBook-Pro-2:nomadcoin user$ ln -s /usr/bin/nodejs /usr/bin/node
ln: /usr/bin/node: Operation not permitted
USER-no-MacBook-Pro-2:nomadcoin user$ sudo ln -s /usr/bin/nodejs /usr/bin/node
Password:
ln: /usr/bin/node: Operation not permitted
USER-no-MacBook-Pro-2:nomadcoin user$ $ sudo apt-get install nodejs-legacy
bash: $: command not found
USER-no-MacBook-Pro-2:nomadcoin user$ $ sudo brew install nodejs-legacy
bash: $: command not found
USER-no-MacBook-Pro-2:nomadcoin user$ npm debug
env: node: No such file or directory
USER-no-MacBook-Pro-2:nomadcoin user$ nvm debug
bash: nvm: command not found
USER-no-MacBook-Pro-2:nomadcoin user$ sudo chown -R $USER /usr/local
chown: /usr/local: Operation not permitted
USER-no-MacBook-Pro-2:nomadcoin user$ npm --version
env: node: No such file or directory
USER-no-MacBook-Pro-2:nomadcoin user$ nvm --version
bash: nvm: command not found
USER-no-MacBook-Pro-2:nomadcoin user$ nvm install
bash: nvm: command not found
USER-no-MacBook-Pro-2:nomadcoin user$ ln -s /usr/local/Cellar/node /usr/bin/node
ln: /usr/bin/node: Operation not permitted
USER-no-MacBook-Pro-2:nomadcoin user$

Trynode -v to see whether you've installed node. I think your node not works.
nvm is the environment managment for node. If you are using nvm, you should brew install nvm, and use nvm install version-of-node-you-want-to-install to install node, and use nvm use the-version to let node works.
Whole install chain is:
brew install nvm, to install nvm, which is environment/version management for node.
nvm install 10.3.0, to install node and npm
npm install -g yarn, to install yarn
use node -v, npm -v, nvm -v, yarn -v to check if they all works.

Perform the below steps:
which node
sudo ln -s /home/ubuntu/.nvm/versions/node/v12.13.1/bin/node (output of above step) /usr/bin/node

For me I realized that hooks don't work when opening through the launcher.
instead I opened SourceTree through the terminal by running this command:
/Applications/SourceTree.app/Contents/MacOS/Sourcetree

I had the same issue on Ubuntu when trying to updating my npm version by using:
sudo npm install -g npm
I've solved by doing the same without sudo:
npm install -g npm

If you already installed nvm or node before and it worked, I would suggest to try to refresh your bash startup file. For example source .bash_profile
There are multiple bash startup file sometimes, you can check which one contains the nvm environment export setting to locate it.

Related

npm is installed but still showing command not found: npm, command not found: nvm

I installed nvm using this code curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
Then I installed node using nvm install node
But after installation when I type nvm --version it shows command not found: nvm and for npm it shows command not found: npm
I checked my home directory and also checked for the hidden .nvm file and the file is there!
I have installed Homebrew, if that helps.
Try running this
rm -R ~/.npm ~/.nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
nvm install node
Full credits to this lovely lad
If that doesn’t work try restarting your cmd

brew fails to install node on mac os big sur

When following the usual tutorial for node installation I get the following error:
➜ ~ node
zsh: command not found: node
➜ ~ brew install node
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> Updated Casks
Updated 1 cask.
Warning: node 15.5.1 is already installed, it's just not linked
You can use `brew link node` to link this version.
➜ ~ brew link node
Linking /usr/local/Cellar/node/15.5.1...
Error: Could not symlink include/node/cppgc/allocation.h
Target /usr/local/include/node/cppgc/allocation.h
already exists. You may want to remove it:
rm '/usr/local/include/node/cppgc/allocation.h'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite --dry-run node
➜ ~ brew link --overwrite node
Linking /usr/local/Cellar/node/15.5.1...
Error: Could not symlink include/node/cppgc/allocation.h
/usr/local/include/node/cppgc is not writable.
do I need to fix permissions, and am I the only one who is currently running into it?
My case was in MacOs Big Sur 11.2.2
when i run brew install node the error output was like yours.
with the next steps i can run node perfectly:
sudo chmod -R $(whoami):admin /usr/local/inclue/node
sudo chmod -R $(whoami):admin /usr/local/share/doc/node
sudo chmod -R $(whoami):admin /usr/local/share/systemtap/tapset
sudo chmod -R $(whoami):admin /usr/local/lib/dtrace
brew link --overwrite node
hope can help you :)

Problem installing node js and npm on Manjaro linux

OS: Manjaro
I installed npm and nodejs by this command: sudo pacman -S nodejs npm
after installation i have an error:
~]$ npm -v
node: error while loading shared libraries: libicui18n.so.67: cannot open shared object file: No such file or directory
~]$ node --version
node: error while loading shared libraries: libicui18n.so.67: cannot open shared object file: No such file or directory
How can i solve this problem?
Install nvm (Node Version Manager)
yay -S nvm
Load nvm
source /usr/share/nvm/init-nvm.sh
You can also add the above line in your environment file such as .bashrc so you won’t have to do it every time.
Install Node.js and npm
nvm -g install npm
Test your setup – open a new terminal and install a package using npm
$ nvm use stable
$ nvm -g install browser-sync
$ browser-sync start --server
I found that you need to install both nodejs and npm from the package manager. If you first install npm however, node is automatically installed as a dependency.
yay -S npm
Installing:
pamac install nodejs
pacman -S nodejs
refer : https://discover.manjaro.org/packages/nodejs

Brew cleanup Error: Permission denied # unlink_internal

I met an error while doing "brew cleanup":
$ brew cleanup
Warning: Skipping opam: most recent version 2.0.3 not installed
Warning: Skipping python: most recent version 3.7.2_2 not installed
Warning: Skipping sqlite: most recent version 3.27.1 not installed
Error: Permission denied # unlink_internal - /usr/local/lib/node_modules/#angular/cli/node_modules/.bin/in-install
Does anyone know how to fix this?
PS: brew link node returns an error, though I don't know if it is related.
$ brew install node
Warning: node 11.9.0 is already installed, it's just not linked
You can use `brew link node` to link this version.
$ brew link node
Linking /usr/local/Cellar/node/11.9.0...
Error: Could not symlink include/node/common.gypi
Target /usr/local/include/node/common.gypi
already exists. You may want to remove it:
rm '/usr/local/include/node/common.gypi'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite --dry-run node
First fix permissions causing the error:
sudo chown -R "$(whoami)":admin /usr/local
On macOS Mojave, the chown command needs to be run on the specific directory, an example for the permissions issue in /usr/local/lib directory, this command would be
sudo chown -R "$(whoami)":admin /usr/local/lib
Then relink node with the --force option as directed:
brew link --overwrite node
This worked for me:
brew unlink node && brew link node

Node installed, but not NPM

I installed node with brew 'brew install node', and I get a warning message
'Warning: The post-install step did not complete successfully'.
When I put in node -v, I can indeed see the current version of node, however when I try to find the current version of npm, I get this error.
-bash: /usr/local/bin/npm: No such file or directory
Is the reason that NPM does not exist because the post-install step did not complete successfully ?
Yup, that thing happened to me too. After a lot of searching I came to a solution. I think this would help you.
sudo brew uninstall node
brew update
brew upgrade
brew cleanup
brew install node
sudo chown -R myusername /usr/local
brew link --overwrite node
sudo brew postinstall node
Thanks!!

Resources