casperjs command not found - node.js

I installed phantomjs on my mac
phantomjs --version
1.9.2
Following the instructions on the casper installation page, I did this
$ git clone git://github.com/n1k0/casperjs.git
$ cd casperjs
$ ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs
However, i'm getting command not found when I run casperjs. I also installed it via homebrew and got the same result.
Any suggestions?
Update
this is what I get when I type $PATH
-bash: /Users/me/.rbenv/shims:/opt/local/bin:/opt/local/sbin:/Users/me/downloads/mongodb-osx-x86_64-2.4.5/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/MacGPG2/bin: No such file or directory
inside
usr/local/bin, there is (among other things) phantomjs and casperjs. I can run phantomjs --version from anywhere and get the version number. casperjs doesn't work

This is most likely due to the symbolic link not being created.
Try running the command directly: /usr/local/bin/casperjs --version
If this results in another Command not found error, then you should try running
sudo ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs
to make sure that you actually create the link in the /usr/local/bin directory
However, if it does exist, you should check to make sure that the link is pointing to the correct directory by running
ls -l /usr/local/bin/casperjs

It seems that you got the ln command line parameters switched: first one is the target, second is the link.

Install casperjs using npm
npm install casperjs
Then you can run it using:
node_modules/casperjs/bin/casperjs selftest

Related

Connot find executable after installation

I am trying to install KICS into AWS EC2 (Ubuntu). I am suing the one-line install script:
curl -sfL 'https://raw.githubusercontent.com/Checkmarx/kics/master/install.sh' | bash
However when I run:
kics version
or
which kics
It seems like it cannot find the command. It forces me to reboot before being able to see it, however rebooting is not an option in my use-case.
As per the documentation of KICS (https://docs.kics.io/latest/getting-started/#one-liner_install_script):
Run the following command to download and install kics. It will detect your current OS and download the appropriate binary package, defaults installation to ./bin and the queries will be placed alongside the binary in ./bin/assets/queries:
curl -sfL 'https://raw.githubusercontent.com/Checkmarx/kics/master/install.sh' | bash
If you want to place it somewhere else like /usr/local/bin:
sudo curl -sfL 'https://raw.githubusercontent.com/Checkmarx/kics/master/install.sh' | bash -s -- -b /usr/local/bin
So by default, it will install in /home/<user>/bin folder if using the first command. This folder may not be in PATH environment variable because of which which command doesn't work.
So, you need to install using the second command in order to install in /usr/local/bin which should probably be there in PATH and after that which command will also work.

sudo: npm: command not found in WSL

I'm trying to install globally some packages for my Unix environment on Windows with WSL. I use nvm to manage the different versions of Node.js.
The problem is while using the sudo command before a global npm install :
sudo npm install --global prompt-pure
I get an error: sudo: npm: command not found !
Doing a simple npm install --global pure-prompt will work, but as I'm not super user, the global installation ends up with a permission error.
How can I fix this annoying problem and keep nvm ?
Thanks by advance
When you try to run sudo npm, it tries to run the npm binary file /usr/bin/npm but your binary is located in a different place, which can be found running which npm.
Example: /home/damo/.nvm/versions/node/v8.11.1/bin/npm
The solution is to create a link in /usr/bin/ pointing to the actual binary:
sudo ln -s "$(which npm)" /usr/bin/npm
You can also add the following link so you can run sudo node
sudo ln -s "$(which node)" /usr/bin/node
For me I needed to actually cheat and run as root before installing node as root. For this I ran sudo su in a Ubuntu WSL term and then installed node.
Once I did that I could sudo su then npm run special-script.
I don't know a better way to get a script to attach to restricted ports like 443 for testing https connections but it works.
As you will find in the man file for sudo man sudo sudo will execute a command as another user. That other user has a different home directory to you and access to different commands
When i run sudo which node i get nothing, but which node returns /home/damo/.nvm/versions/node/v8.11.1/bin/node
Lets look at your actual goal. You say you are trying to install pure-prompt, i know this does not ask your explicit question but given you have zsh installed have you tried oh-my-zsh (https://github.com/robbyrussell/oh-my-zsh) i use this on every install of linux i ever have to work with (VMs, WSL, docker). Very customizable and looks great out of the box.

node in ubuntu: can't run without full path despite $PATH setting

A seemingly contradictory set of outcomes:
$ /usr/local/bin/node --version
v5.2.0
$ node
The program 'nodejs' is currently not installed. You can install it by typing:
sudo apt-get install nodejs
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
I would appreciate if someone could point out what could possibly be wrong with the configuration of the $PATH.
For installing node, I've followed these instructions.
Thanks.
Despite source ~/.bashrc the PATH was not being updated. Yet, upon creating a new terminal with a new bash prompt, then it did: which node showed the correct path, and node resulted in a prompt. Puzzling. But resolved.

Installing after build phantomjs 2.0 on linux

i followed the instructions here: http://phantomjs.org/build.html then i build it on linux (ubuntu), after this i get on this point "This produces a build bin/phantomjs. This is an executable; it can be moved to a different directory (e.g. /usr/local/bin) or another machine."
Yes it's there, an executable, but how i install it now? i tried using the commands phantomjs on terminal, i only had succes if i install it trough the command sudo apt-get install phantomjs or sudo npm install phantomjs
after this i run the code phantomjs -v and get the version: 1.9
i tried to run my code with phantomjs 1.9 but he ask's for 2.0
and i dont know how to install this exec file or use it to install the phantomjs 2.0, already tried to execute the file by double clicking, and using the command ./phantomjs on the directory... Also tried to run like windows, you go to directory which is the .exe file and then run the command normal like, phantomjs code.js but i doesn't work.
Sorry for this newbie question, im new with linux, starting using it this week.

Node.js not found

I am using ubuntu 10.10, I installed nodejs from source ( ./configure && make && sudo make install ) and all done successfully. I tried to start nodejs CLI using
node
it says
bash: /usr/sbin/node: No such file or directory
note : i also referred these following questions
Express.js: No Such file or directory,
nodejs vs node on ubuntu 12.04
but still not able to rectify.
never mind, i found node in /usr/local/bin/node.
so the following command made it work.
sudo ln -s /usr/sbin/node /usr/local/bin/node

Resources