teach me how to set up a path correctly - node.js

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

Related

How to reset the $PATH?

I confess, I very don't know what I'm talking about.
This morning I wanted to install Javascripting (to learn javascript) on my Mac, so I watch a video to do it:
I downloaded node.js and I installed it;
after that I opened the terminal and I type: npm install -g javascripting and here I've got some errors. I tried to search the solution but I think I created a big problem:
Basically I modified the $PATH several times and now the situation is this.
If I run echo PATH it displays
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
I wanted to clean it all so I tried to type:
brew uninstall --force node
but the terminal says:
zsh: command not found: brew
I can't do anything.
Please, someone help me :(
If you just want to clear this environment variable, just do 'unset PATH'.
But, be aware that PATH is used by a shell (i.e. bash, ksh, zsh...) to look for programs in these directories. clearing it has side effects.
The 'brew' program is somewhere, to find it, you could use the following command :
find / -name 'brew' -print
It can take a little while to find it.
Either use that found path, or add the directory where that program is found to the PATH variable, as in
PATH=$PATH:/location_of_brew_program; export PATH

Plowshare with disabled JS interpreter

I try to use plowshare to download files with command line but on ubuntu I got this error: "Use of Javascript interpreter is disabled in debian for security."
I've found that I should add environmental variable: "PLOWSHARE_DEBIAN_JS=yes"
I added it to ".bashrc" in home directory, with source after that but it doesn't work, i can't find anything what can help, anyone know how can i enable JS?
Not sure if you found a resolve. But I fixed this issue by command export PLOWSHARE_DEBIAN_JS=yes then you might encounter another issue like "Javascript interpreter not found. Please install one" just install nodejs sudo apt-get install nodejs

Shopify's 'slate' package not running after installation

I just installed Shopify's 'Slate' package using npm.
Terminal shows that the package was added to '/.npm-packages/lib'.
However, when I attempt to build a new shopify theme using the command 'slate theme newthemename', the command isn't found...
...even though slate clearly was installed.
Curious to figure out what I'm doing wrong, so any help/advice is much appreciated!
Please execute the below command from your terminal.
npm link #shopify/slate
Basically this command creates a symlink to your package folder, it will check for the global (npm) modules first, and will check for the local modules if there is no match.
Hope this helps!
Your installation of slate is successful. However, the slate program (slate/lib/index.js) is not added to environment variable PATH, that's why error command not found is reported.
To fix this issue, a simple method is add slate/lib/index.js to PATH manually. For example, create a symbolic link in /usr/local/bin/ and make it point to slate/lib/index.js:
sudo ln -s /<absolute_path>/#shopify/slate/lib/index.js /usr/local/bin/slate
Please note the first parameter of ln -s must be absolute path. If relative path is used, Mac OS X (I'm on 10.12.6) won't help to translate it.

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

Problems with Coda 2/CoffeeScript plugin

Regarding plugin for Coda 2. I am having some problems making it work. I have written a small test program in CoffeeScript, but when i try to run and/or compile I get the following error message:
All settings/env. variables should be set correctly:
Do you have any idea as to what that may cause this issue? I have installed node using homebrew, and then coffee script via npm. All the shell variables have been verified, and I am able to run node from the command line and write scripts there. Also, when i go to settings and click on "About", I get the following:
Hope you can help.
Thank you and best regards,
Thomas
In Terminal, run the command:
which coffee
For me, this gave:
/usr/local/bin/coffee
So in the CoffeeScript Plug-In Settings, I set PATH to:
/usr/local/bin
Then when I went to the About box, it showed the version of CoffeeScript that I have installed and the Run & Compile options then worked fine.

Resources