Cannot run the newman command on windows 10 - node.js

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.

Related

npm global install not recognized (gulp)

I'm trying to use gulp for the first time.
Following instructions online, I installed it globally as well as locally, but I still get the
'gulp' is not recognized as an internal or external command[...] error. When using PowerShell instead of cmd the error is the term 'gulp' is not recognized as the name of a cmdlet, function, script file[...]
I've tried:
installing gulp-cli in addition to gulp
adding / changing PATH variables
restarting my PC
running npm install -g npm#latest to make sure npm is up-to-date
I'm stumped. On top of all that, I have other npm packages installed globally that work fine.
Edit: I fixed this by adding npm to my PATH environment variable. I had been adding it to NODE_PATH, which doesn't work for CLI use.
"Global install" with the -g flag basically means you install the command provided with the package.
To globally install gulp:
npm install gulp -g
You can add the gulp script in the package.json file and run the gulp command using npm.
Ex:
gulp task name : helloTest
Add below code in package.json:
"scripts": {
"helloTest": "gulp helloTest",
}
And now type below command in terminal:
npm run helloTest

Node command not found

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)

unable use any installed npm packages

I'm trying to use node on my fedora 21 installation. However whenever I install a package via npm I am not able to to call that package such as gulp.
npm install -g gulp
then : gulp run
error:
zsh: command not found: gulp
You need to point your global $PATH variable to the location of node. Otherwise, it will return that error.
Open your .zshrc file and ensure you see something like PATH=/usr/bin/node:$PATH (ensuring your directory is the proper one for node). You can find that directory location with the command npm -g bin.
If that doesn't work, comment below. Thanks
The directory where npm installed gulp is not in your path. To find out where it was installed, run npm -g bin and make sure the directory is in your path. Alternatively, execute gulp as $(npm -g bin)/gulp.

Using GRUNT from NodeJS error message "'grunt' is not recognized as an internal or external command, operable program or batch file"

The webproject that I am working on uses SASS which is compiled into Grunt tasks, and grunt is supposed to run in NodeJS.
I have been given these instructions but it's not working:
I installed NodeJS (default folder/settings)
I then went in my project folder in CMD C:\Users\Ben\Desktop\officeincambridge>
Then ran the command npm install -g grunt-cli
and npm install grunt
If I type NPM version (in dir above) I get npm --version: 1.4.14 , node --version: v0.10.29
However, when if I try and compile the files using grunt sass i get this error message 'grunt' is not recognized as an internal or external command, operable program or batch file.
Can anyone assist me on how to use it (I have never used grunt before). HERE are the instructions which I am using.
Thank you
Try to install
npm install -g grunt-cli
This seems to be a duplicate of this question: Grunt on Windows 8: 'grunt' is not recognized
In his case, it was a PATH issue. Check that your PATH is correct. It must contains the path where npm is installed: C:\Users\Ben\AppData\Roaming\npm
I also had the same issue :
To Solve this
I have added "grunt path" in SYSTEM environment Variable .
C:\Users\\AppData\Roaming\npm\grunt
To find your grunt path Use Command(in cmd) : where grunt
Once Added Path to SYSTEM Environment Variable Restart Jenkins and build job again

Running karma after installation results in 'karma' is not recognized as an internal or external command

I'm trying to run karma as part as an angular-seed project, after installing karma using
npm install -g karma
I get:
'karma' is not recognized as an internal or external command, operable program or batch file.
when i'm trying to run test.bat from angular-client\scripts, the content of this file is:
set BASE_DIR=%~dp0
karma start "%BASE_DIR%..\config\karma.conf.js" %*
I also tried to navigate to "\AppData\Roaming\npm\node_modules\karma\bin" and saw karma file, when I'm trying to run it I get again:
'karma' is not recognized as an internal or external command, operable program or batch file.
Any suggestions?
If not please suggest how to use jasmine without karma.
Thanks.
The command line interface is in a separate package.
To install this use:
npm install -g karma-cli
karma-cli
It is recommended to install karma with its Command-Line-Interface (karma-cli) which will take care of fetching the appropriate karma. You can also install a different local version specific to each project you're working on and karma-cli will pick the appropriate one.
From the karma installation page:
Typing ./node_modules/karma/bin/karma start sucks so you might find it useful to install karma-cli globally:
npm install -g karma-cli
Now, check that karma was installed by typing:
which karma //echo something like: /usr/local/bin/karma
and check that karma server is working (ctr+c to quit):
karma start
You can also check that karma was installed by going to this directory:
cd /usr/local/lib/node_modules/karma
Good luck!
On windows when you install a npm (non-globally - so without the -g flag), the executable commands are linked in the node_modules\.bin folder.
For example:
powershell> .\node_modules\.bin\karma start
powershell> .\node_modules\.bin\karma run
I had the same issue and fixed it by correcting my PATH environment variable.
STEP 1: go to the following path and ensure karma.cmd is present at the location given below
[Nodejs folder path]\node_modules\.bin <=> C:\Program Files\nodejs\node_modules\.bin
STEP 2: If present go to STEP 3, If not present run the following command npm install -g karma
STEP 3: Open environment variables and edit PATH
STEP 4: Add the following at the end :
[Nodejs folder path]\node_modules\.bin; <=> "C:\Program Files\nodejs\node_modules\.bin"
Log out your session and it will work for sure.
Based upon your directory using \AppData\Roaming, you're on Windows and this error is usually because the path to the npm globals isn't in the Windows PATH or NODE_PATH environment variables.
Use SET to check the values you are using for the paths and if your npm directory isn't listed, that will be the issue.
If you don't want npm to save to this directory, check the npm configuration options and the npm folders docs to see what you can change in this regard...
'karma' is not recognized as an internal or external command, operable
program or batch file.
If the above mentioned solution does not work, than
The cause of issue is previous version of nodejs. So uninstall the previous version of nodejs and re-install the latest version. It will resolve your issue. As I faced the same and by doing above changes it worked for me.
Thanks.
Official documentation at https://karma-runner.github.io/0.12/intro/installation.html is confusing. It implies that npm install -g karma-cli is to install karma globally but it actually required for to run karma from command line.
I had same: 'karma' is not recognized as an internal or external command, operable program or batch file. problem when i tried to install it directly to my project file. When i used npm install -g karma-cli to global install everything worked just fine.

Resources