Running Karma from TeamCity - node.js

Does anyone know how you would run the following command within TeamCity? (the command is normally ran in a Node.js command window)..."Karma start karma.conf.js". I have successfully installed Nodejs on the TeamCity server. I have then successfully installed Karma on the same server (using npm install -g karma).
In TeamCity, my build step has "Runner type = Command Line", and the Custom Script is set to "FULLPATHOFKARMAEXE\karma.cmd start FULLPATHOFKARMACONFIGFILE/kara.conf.js"
When i run TeamCity, it comes back with the error "node is not recognized as an internal or external command"
Anyone know the step-by step process of running Karma within TeamCity?

In your case, the Karma installation seems to be OK, but your TeamCity agent process is unable to resolve the path to Node.exe (it's installation folder is missing from the %PATH% variable).
First verify the NodeJS installation by opening a Commandline window on the agent machine, type node and press enter:
c:> node
>
If the result in your Command window is a >-prompt, you might solve your problems by restarting the build agent.
If the result in your Command window is some error message saying "node is not recognized as an internal or external command", you need to add the NodeJS installation folder to the %PATH% variable, and restart the build agent.
You can, of course, just change the %PATH% for your build agent service by running a initialization script included in the NodeJS installtion folder in your build step. Depending on where your NodeJS installastion is, your custom script might look like this:
"C:\Program Files (x86)\nodejs\nodevars.bat"
"FULLPATHOFKARMAEXE\karma.cmd start FULLPATHOFKARMACONFIGFILE/kara.conf.js"

Related

Why can't Visual Studio fro Mac run node?

I've installed Visual Studio for Mac community 8.10.11 and created a new Project based on React + .net Core WebAPI. But If I try to run the app, I got
/Users/xxx/Projects/yyy/yyy/yyy.csproj(5,5): Warning MSB3073: The command "node --version" exited with code 127. (MSB3073) (yyy)
/Users/xxx/Projects/yyy/yyy/yyy.csproj(5,5): Warning MSB4181: The "Exec" task returned false but did not log an error. (MSB4181) (yyy)
/Users/xxx/Projects/yyy/yyy/yyy.csproj(5,5): Error: Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE. (yyy)
My bash knows node and the folder is also part of echo $path. How can I add it to VS?
Thanks!
I experienced the same issue because I used homebrew to install Node.js.
According to the Homebrew documentation:
GUI apps on macOS don’t have Homebrew’s prefix in their PATH by default. If you’re on Mountain Lion or later, you can fix this by running sudo launchctl config user path "$(brew --prefix)/bin:${PATH}" and then rebooting, as documented in man launchctl. Note that this sets the launchctl PATH for all users.
If you installed node from elsewhere, you should be able to modify this command to include the path to wherever your node executable is:
sudo launchctl config user path "<path-to-bin-folder>:${PATH}"

electron-winstaller throws The system cannot find the path specified. at Squirrel.Utility.<CreateZipFromDirectory>d__23.MoveNext()<---

I am trying to build a electron installer for windows platform in Azure DevOps. I have successfully ran the electron-package command with npm run build (look at my package.json). After that when I try to run the command to create the RELEASES, .msi, .exe and .nupkg files with electron-winstaller it throws an error saying:
The system cannot find the path specified.
at Squirrel.Utility.d__23.MoveNext()<---
The command that I executed was npm run create-installer-win which executes the command node build.js.
The build runs in a on-premises agent with windows server 2014.
Locally everything works fine.
Image of my build.js
Image of my package.json
enter image description here
The was with Squirrel.
My agent is running with NT AUTHORITY\System user which does not have permission to create the SquirrelTemp folder in %appdata%. When it try to create de folder in current folder it throws the error because it does not find the SquirrelTemp folder.
The solution I have found was to set a environment variable SQUIRREL_TEMP in the build pipeline with the value to %currentfolder%\SquirrelTemp and it works.
Thanks to https://github.com/Squirrel/Squirrel.Windows/issues/1081#issuecomment-340958128

Locally installed executable dependencies fail using npm run/yarn run on Windows

I am using a Windows machine as my primary development machine. I usually use WSL for most of my projects, but one of my electron projects requires me to work in the Windows environment. So I've set up node, npm, yarn & git on the Windows side as well. But I am having troubles with locally installed dependencies.
Say, I have added concurrently to my project using yarn add concurrently. Now if I do yarn run concurrently, it fails saying that 'C:\Users\Praneet\Projects\my-project\node_modules\.bin\concurrently' is not recognized as an internal or external command. But if I do yarn run concurrently.cmd, it works. Same thing happens for scripts in package.json. I have to change react-scripts start to react-scripts.cmd start to make it work. But I don't want to do this for every script, because there are other devs working with me who use MacOS. I will be really grateful if someone could help me with this.
Have you tried running these commands using Windows Powershell? It might work.
Another option (the one I use when I must code in a Windows environment) is to use Git Bash: https://gitforwindows.org/
It simulates a BASH for Windows, so the commands you are trying to run should work without the .cmd.

'ng' is not recognized as an internal or external command, on windows 64 bit system

I have successfully installed node 8.11.1 and npm 5.6.0
After that I have installed angular CLI also as below
npm install -g #angular/cli
When I am trying to create project using below command
ng new MyApp
I am getting error as "ng is not recognized as an internal or external command, operable program or batch file"
Please provide solution for the same if I am doing anythin wrong please let me know.
Complete details are showing in attached screen shot
You need to add that installation in your environment variable of your system. Since, you are using windows go to your environment variable ,
From the desktop, right click the Computer icon.
Choose Properties from the context menu.
Click the Advanced system settings link.
Click Environment Variables. If the PATH environment variable does not exist, click New and create one
In the Edit Environment Variablewindow, specify the value of the PATH environment variable. Which should be C:\users\YOUR_USER\AppData\Roaming\npm\node_modules\#angular\cli\bin
Click OK. Close all remaining windows by clicking OK.
Reopen Command prompt window, and run ng new MyApp. It should work now.
ng is not recognized as an internal or external command, operable program or batch file
Many of us has face this error, while working with angular in windows
system. So to solve this error just in command prompt/Power shell, u
have to install the lower version of angular or the same version of
angular as that of ur project of angular version.
You have to run command npm i #angular/cli at
C:\Users\Dell\AppData\roaming\npm> at this file path and all the
error of ng will resolved

I can't run test with "vows test/*" command on windows. How to use it? node.js

I've installed vows as module of my project and I've added the path "node_modules\vows\bin" to my environment path variable of windows vista.
note: I've also renamed "node_modules\vows\bin\vows" to vows.exe, because without the extension I get this error: 'vows' is not recognized as an internal or external command,
operable program or batch file.
Now wherever I put "vows" in my cmd in windows nothing happens, I cd into my test folder and I run "vows myFirstTest.js" and nothing happens. (when I say nothing happens my cursor in cmd is going to the top and then return to it's original position and it's doing this forever, therefore each time I try a vows command in cmd I have to close the cmd to run another command).
What I'm doing bad?
thanks
NPM is great at globally installing packages and making the executable for each operating system (UNIX-ish + Windows), so proceed with the following:
npm install -g vows

Resources