Unable to access Node on Mac - command not found - node.js

I am getting the following response when I try to access node from terminal
node:command not found
I researched and found that I have to set PATH. I tried the following:
export PATH="/usr/local/bin/node:$PATH">> ~/.profile
It runs (I assume since the terminal doesn't return anything). But when I echo the path I get the following response
export PATH=/usr/local/bin/node:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/arihantjain/NVPACK/android-sdk-macosx/platform-tools:/Users/arihantjain/NVPACK/android-sdk-macosx/tools:/Users/arihantjain/NVPACK/apache-ant-1.8.2/bin
Clearly, I think the path isn't getting set. How can I do that? If not, is there a way to change the default installation directory of node. I used the .pkg installer to install Node.

Related

Go moq : running "moq": exec: "moq": executable file not found in $PATH

when trying the example of the moq framework, I get the following exception when I enter "go generate":
example.go:5: running "moq": exec: "moq": executable file not found in $PATH
What should I do? I'm using Kubuntu 16.04
PS: I tried
export PATH=$PATH:/home/[...]/go/src/github.com/matryer/moq
without success
#sprabhakaran got the right answer. I only needed to add the go binary folder to the PATH global variable:
export PATH=$PATH:/home/[...]/go/bin
and if it doesn't work, check that moq was correctly installed.
First, install using the following command:
go install github.com/matryer/moq#latest
Go binary should be added to the global PATH
export PATH=$PATH:$HOME/go/bin
worked for me on MAC

Browser-sync command not found even after setting the correct path to the environment variable

I am facing a problem which i found some solutions but it is still not working.I installed nodejs for windows 32 bit version, and everything went well.Now when i installed browser-sync via command line running the command
$ npm install -g browser-sync
Now everything got installed correctly with a couple of warnings. Now when i ran the command
$ browser-sync --version
it said browser-sync command not found.So i googled and found out that my environment variable might not be set correctly so it is not picking up my command. So then i tried finding the correct path to be set in the env variable via the following command which gave the result
$ npm bin -g
C:\Users\TEMP\AppData\Roaming\npm;npm\npm
(not in PATH env variable)
So i tried adding the path via the command
$ PATH %PATH%;C:\Users\TEMP\AppData\Roaming\npm;npm\npm
But it is still not working.I checked whether the path is actually added directly from the environment editor and via running the command $ Path,and it is actually adding the path but the problem still persists.
I think the problem is with the folder name which has semicolon in it "npm;npm" which is actually used to separate paths.I am not quite sure why it is adding the folder with such a name, i tried renaming it but as soon as i run the command npm bin -g it makes a new folder with the same name.
Also i tried using the short name for the folder which was "NPM_NP~1" to avoid that semicolon issue but it is still not working.
I am stuck with this since past 2 days and hopefully i can find a solution from you guys so i can get on with some actual development work. I gave you guys as much info as i could. Let me know if you need something more and specific.
You need to have NODE_PATH set:
$ set NODE_PATH=%AppData%\npm\node_modules

teach me how to set up a path correctly

I installed casperjs by npm install command on my mac os x.
But, when I try using casperjs in command line, it gives me the error below.
$ casperjs cas.js
-bash: /usr/local/bin/casperjs: No such file or directory
I checked if casperjs is installed by using which command.
The result is below.
$ which casperjs
-bash: /Users/Hayato/.nodebrew/current/bin/casperjs
I think what I need to do is to setup a path in a different way so that when I run "casperjs test.js", it runs "/Users/Hayato/.nodebrew/current/bin/casperjs" instead of "/usr/local/bin/casperjs".
But, I'm not familiar with this kind of terminal task, and don't know how to do this.
Please could anyone teach me how to setup a path correctly?
Thanks!
If you want to use casperjs in the directory you specified, add this to your ~/.bash_profile
export PATH=/Users/Hayato/.nodebrew/current/bin/:$PATH
Save the file
That will add all scripts in the /Users/Hayato/.nodebrew/current/bin directory to your path.
After that.. close the terminal and then reopen it:
You can check the path by doing:
echo $PATH
You should see the path you just added.
Then when you do the following:
which casperjs
it should use the new location.
Let me know if this works for you!
But, the issue may be something deeper, did you get errors when you installed casperjs via brew?
You may want to try linking it again using
brew link casperjs
If that doesn't work you may have some permission issues.
Check out these previously answered questions:
brew link didn't complete
Fixing homebrew permissions

Showing error "nvmw command not found" when setting the path of nvmw in Nodejs

I am new in Nodejs. I want to install nvmw in my system. For that first I clone the respiratory using this command
git clone git://github.com/hakobera/nvmw.git "%HOMEDRIVE%%HOMEPATH%\.nvmw"
after that for activating nvmw, I used this command
set "PATH=%HOMEDRIVE%%HOMEPATH%\.nvmw;%PATH%"
in E drive.Folder is also created in E drive in name of %HOMEDRIVE%%HOMEPATH% and inside the folder all the datas and nvmw folder also created.
But after that when I am running this command nvmw help, it shows "nvmw command not found". I tried by changing the folder name also but it shows the same error. I think I am doing some mistake in setting the path.
In my case, that command is not working on Windows PowerShell.
The command for setting System Path should be run Windows Command Prompt.
In the other hands, you can add installed path with GUI.
For Windows PowerShell, see following question:
Setting Windows PowerShell path variable

Cannot run 'phonegap' command on Win 7

I've just installed phonegap on Windows 7, following the instructions on their website. However, whenever I try to run a simple 'phonegap' command, I get the error:
'phonegap' is not recognized as an internal or external command
I put the phonegap path at the enviroment variables 'PATH' but that didn't do anything at all.
I've also made sure WSH was enabled, but still nothing works.
Am I missing something?
It may just be that the path has not been updated (Have you restarted your machine?)
Alternatively, you can copy the path onto the clipboard, then in a cmd window, do the following:
set path=%path%;<Your path here>
Which will include it in your path for the current session only.
Figured this out...I accidenatlly deleted some nodeJS variables while adding ant and java pathes. Had to reinstall node to realize this.

Resources