0

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!

1 Answers1

0

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

Community
  • 1
  • 1