Node command not found - node.js

I'm trying to install avrgirl-arduino using the command sudo npm install avrgirl-arduino. When I try running the command avrgirl-arduino list I get an error saying -bash: avrgirl-arduino: command not found. I ran npm init before running the first command and it still doesn't work.

You may want to install your package globally :
npm install -g avrgirl-arduino
This way you can use command line tool package (like grunt)

Related

Cannot run the newman command on windows 10

I tried to install newman globally but no luck and here is what I did:
First I installed newman as follows:
Then I ran the command newman -h in another command prompt window:
'newman' is not recognized as an internal or external command, operable program or batch file.
I looked for the newman module in the following folders but I didn't find any:
C:\Users\my-username\AppData\Roaming\npm\node_modules
C:\Users\my-username\AppData\Roaming\npm
C:\Program Files\nodejs\node_modules\npm\node_modules
Any idea on how to solve this issue?
Cause:
After spending some time trying to solve this, I found out that npm is not configured correctly, and it installs the module in another directory.
Solution:
Make sure that npm prefix is set to the path where NodeJs is installed using the following command:
npm config get prefix
In my case, I already installed NodeJS before running npm install -g newman in the following path:
So what I did to solve the issue, is to run the following command:
npm config set prefix "C:\Program Files\nodejs"
and then I re-installed Newman globally with npm install -g npm and that's all.
In the existing answer https://stackoverflow.com/a/71785032/7733418 , the last command for installing Newman should be
npm install -g newman, instead of
npm install -g npm.

How to run TopoJSON on Mac?

I need to bind a CSV file to topojson. I installed Node js with brew.
I can successfully run the command npm install -g topojson but when I put in which topojson, it doesn't return any file path.
I checked to confirm I have the command line tools installed and I do.
My command to bind the CSV returns -bash: topojson: command not found even though the npm install -g topojson command runs smoothly.
topojson package installs five executables: geo2topo, toposimplify, topomerge, topo2geo, topoquantize.
Getting command not found for trying to execute topojson is the normal response: indeed, such an executable does not exist.

Install for #angular/cli not working on Mac

I'm trying to setup Angular 2 using "npm install #angular/cli -g "
After the install, the only warning I see is the UNMET PEER DEPENDENCY rxjs#^5.0.1, which I then install and reinstall "npm install #angular/cli -g"
No matter what I do, or what version of Node I setup with n, I keep getting the following message when trying to user the "ng" commands:
zsh: command not found: ng
I've been looking around and have not found a solution for this.
Has anyone run into this and have any suggestions?
UPDATE:
It looks like this is not a angular/cli specific issue.
I now see that I get the same message when I try to run "Grunt" and "Ionic" commands on an existing project that was working fine.
zsh: command not found: ionic
zsh: command not found: grunt
Most likely, the directory in which the global modules are installed is not in your $PATH -- and therefore unknown to your shell.
To fix this issue, we can create a new directory for global node_modules, configure npm to use it, and add that directory to your $PATH.
# create a new directory where npm will install packages
$ mkdir ~/.node_modules
# set npm "prefix" config to that directory
$ npm config set prefix '~/.node_modules'
# append a line to your .zshrc instructing it to include that directory in your $PATH, making the executables known to the shell
$ echo 'export PATH=~/.node_modules/bin:$PATH' >> ~/.zshrc
# update current shell with new path (not needed for new sessions)
$ source ~/.zshrc
Then, first reinstall the latest npm (npm i -g npm), followed by the global packages you need (npm i -g #angular/cli).
For more on PATH, see this definition: http://www.linfo.org/path_env_var.html

Installing NPM package globally does not create bash command

I've tried to install http-server. It installs fine. Here's the output:
$ npm install -g http-server
/Users/jonrojas/.npm-packages/bin/http-server -> /Users/jonrojas/.npm-packages/lib/node_modules/http-server/bin/http-server
/Users/jonrojas/.npm-packages/bin/hs -> /Users/jonrojas/.npm-packages/lib/node_modules/http-server/bin/http-server
/Users/jonrojas/.npm-packages/lib
└── http-server#0.9.0
As soon as I try to run hs, I get:
-bash: hs: command not found
When I try npm config get prefix, I receive:
/Users/jonrojas/.npm-packages
How would I update my .bashrc file to get this working? (or other steps?)
To note: this isn't specific to http-server. I also tried to install another package that has a bash command, but it also did not work.

sh.exe": http-server: command not found

After I ran following command
npm install
it was successfully executed
But when i tried to execute following command
http-server
It gave following error
sh.exe": http-server: command not found
Can somebody help me out to solve the above error
You have installed the http-server package locally, rather than globally.
Check the node_modules/.bin/ folder, find the executable and execute that.
If that works try $(npm bin)/http-server if you are running from git bash. If you use the windows command prompt try node_modules\.bin\http-server.cmd from the same folder where you ran npm install

Resources