i have problem in VS code terminal to run npm command - npm

npm : The term 'npm' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
there is a error

I had this same problem but as a solution, try running all npm commands in your cmd as an administrator, and you'd be fine.

Related

'..' is not recognized as an internal or external command, operable program or batch file. (lite-server)

I am following this truffle pet-shop tutorial
When i try npm run dev i get the following error message:
> pet-shop#1.0.0 dev
> ../../../Desktop/BlockchainTechnology/pet-shop-tutorial/node_modules/.bin/lite-server
'..' is not recognized as an internal or external command,
operable program or batch file.
The folder is not located in Desktop.
I have already tried npm install lite-server#2.3 --save-dev
I downloaded the project from a friends git, the .gitignore only includes node_modules/
I found the issue.
The package.json files run script had stored the local path from my friends computer.
So i changes from:.
run : '../../Desktop/project/node_modules/lite_server'
to
run : 'lite_server'

'ch5-cli' is not recognized as an internal or external command, operable program or batch file

Even after installed
npm i #crestron/ch5-utilities-cli
ch5-cli giving below error
'ch5-cli' is not recognized as an internal or external command,
operable program or batch file.
as per document https://www.npmjs.com/package/#crestron/ch5-utilities-cli
It is worked when installed globally as below
npm install -g #crestron/ch5-utilities-cli

Azure DevOps - npm invisible

I have a strange problem with a release pipeline in Azure DevOps.
I have two tasks:
1) Install packages
2) Run npm using the above packages
All seems to be easy so what I do is:
1) Command line task
npm install -g mkdirp 1.0.3
npm install -g newman
npm install -g newman-reporter-junitfull
2) PowerShell task
$(newman run $collection -e $environment --env-var "x=$(x)" -r junit --reporter-junit-export $resultFile)
This all worked fine until today. I tried a lot, but nothing works.
The error I have is:
newman : The term 'newman' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and
try again.
Did anyone have a similar issue?
I ran above npm install scripts in a Command line task, and found only the first npm install command got executed. And my following powershell task to run newman command failed with above error message too. You can check the log of Command line task to see if it is the same issue.
If you want to report this issue, you can report a problem here.
The workaround i found is to run the npm install commands in a Powershell task too, do not use Command line task. Then the npm install commands will all get executed and the following powershell task can run successfully.
Or you can separate above three npm install commands into three Command line tasks to install them separately, which will make sure the newman library is installed.

How to run test in nightwatch?

I just installed git clone https://github.com/nightwatchjs/nightwatch.git and when I run :
npm run unit-tests
from the commandline in windows I get an error:
> ./bin/nightwatch -c test/nightwatch.json
'.' is not recognized as an internal or external command,
operable program or batch file.
Got a sneaky feeling it will work in OSX but can I run this in windows in the commandline?
Found it had to put "node" in front of it.

running bower from TeamCity (Windows)

I've got a set of build steps in a project (Team City 9.0c)
One of them is running bower install which is a simple command line execution with no parameters.
Bower is installed on the system (I can run it just fine from the command prompt on the machine) but I get the following error
[10:47:35][Step 2/7] Starting: D:\TeamCity\buildAgent\temp\agentTmp\custom_script8385462966123630321.cmd
[10:47:35][Step 2/7] in directory: D:\TeamCity\buildAgent\work\5d43cd6017ab83d4\website\Amaze.Web
[10:47:37][Step 2/7] 'bower' is not recognized as an internal or external command,
[10:47:37][Step 2/7] operable program or batch file.
[10:47:37][Step 2/7] Process exited with code 1
[10:47:37][Step 2/7] Step Bower (Command Line) failed
I've seen this before where PATH is not set to the location of the npm binaries in c:\users\xxxx\roaming\... so the TC user cannot find them, however PATH is correct.
Both npm and grunt work successfully. What could be causing this?
Is the path variable defined a user variable? If so, it should be a system variable which will be used by the TeamCity process.
You haven't written which accounts the build agent runs as.
I had a similar problem and my build agent was running using Local System. I had to create a dedicated windows user account for the teamcity build agent, in the build script I added
npm install -g bower
set path=%path%;c:\path_to_bower_for_this_user;