Unable to build Angular project using Jenkins - angularjs

I need to run the following commands:
bower update
grunt build
I am getting the following error:
C:\Program Files (x86)\Jenkins\jobs\Build\workspace>export PHANTOMJS_BIN=/usr/lib/node_modules/phantomjs
'export' is not recognized as an internal or external command,
operable program or batch file.
C:\Program Files (x86)\Jenkins\jobs\Build\workspace>export XDG_CONFIG_HOME="$WORKSPACE/.config"
'export' is not recognized as an internal or external command,
operable program or batch file.
C:\Program Files (x86)\Jenkins\jobs\Build\workspace>bower update
'bower' is not recognized as an internal or external command,
operable program or batch file.
C:\Program Files (x86)\Jenkins\jobs\Build\workspace>grunt build
'grunt' is not recognized as an internal or external command,
operable program or batch file.
Please suggest

export command is not for Windows; it's for *nix machines. If you want to set some path on Windows OS, use set command. Remember that this value will be set only for the current shell. Once you close the command prompt, the value will also get unset.
For example,
set PHANTOMJS_BIN=/usr/lib/node_modules/phantomjs
set XDG_CONFIG_HOME="$WORKSPACE/.config"
For the third and fourth error, you have to make sure that bower (and grunt) command is in the PATH otherwise the system will never be able to locate the command as is happening right now. To make it work, just add the path to bower executable in PATH variable.
set PATH=%PATH%;path_to_bower_executable
For example, if bower command is in c:\bower\bin, just add
set PATH=%PATH%;C:\bower\bin
To set your changes permanently, you can go through the steps mentioned in this link.

Problem solved. This is what I am doing now.
set PATH=PATH=C:\Windows\system32;C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\Java\jre7\bin;
C:\Program Files\nodejs\;
C:\Ruby200\bin;
C:\Program Files (x86)\Git\bin;
C:\Ruby200-x64\bin;
C:\Users\appcito\AppData\Roaming\npm
cd testnew
cd ui
call npm cache clear
call npm install
call bower cache clear
call bower install
call grunt build

Related

Jenkins not able to run Poetry in batch file. Works when run manually

I'm attempting to get Jenkins to run a .bat file which contains a call to Poetry (for package management).
However, when running this .bat file via Jenkins, I'm getting a "'poetry' is not recognized as an internal or external command, operable program or batch file." error.
I believe this is due to the .bat file failing when it attempts to run a "call poetry check" command.
The .bat file runs successfully when run manually.
Is there some obvious feature of Jenkins that I'm missing here?
I'm aware that there is an alternative method of embedding poetry into Jenkins with direct commands. However this project is about to be passed on to someone else, and they would not be able to maintain that.
I've reproduced the key code below (the Jenkins code calling the .bat file, the code in the .bat file and the error output from Jenkins).
Jenkins code (standard pipeline with default settings):
pipeline {
agent any
stages {
stage('Main') {
steps {
bat 'E:\\project-folder\\project_run.bat'
}
}
}
}
Bat file code:
#echo off
cd /d "E:\project-folder\"
call poetry check && (
echo poetry checked
) || (
echo Problem with poetry
EXIT /B
)
echo Installing prod packages
call poetry install --no-dev && (
echo Production packages successfully installed
) || (
echo Problem installing packages to environment
EXIT /B
)
call python local-program.py
EXIT /B
)
Jenkins Error:
C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins.jenkins\workspace[Pipeline_Name]>E:\project-folder\project_run.bat
Moving to project directory
'poetry' is not recognized as an internal or external command,
operable program or batch file.
Problem with poetry
Windows is looking up executables on the path you specify. If you run a command without a path, Windows looks for the command/executable in all directories specified in the environment variable PATH.
Very likely your Jenkins is running with different path settings than your interactive shell.
What you can do:
specify the full path to the command you want to raise in Jenkins
set the PATH variable in the Jenkins job prior to running the command
set the PATH variable before invoking Jenkins
Apart from the directory, Windows also has to check extensions. If you run poetry, Windows may have to find poetry.com, poetry.exe, poetry.bat or poetry.cmd. I suspect one of these files reside in E:\project-folder. To understand which files Windows checks for and the preference, have a look at the environment variable PATHEXT.
So to better understand these differences you can run the command set without parameters. Do that on the command line, and add the same command into your Jenkins job.

I can't install Atom Packages

anyone can help me I can't install Packages In Atom.
here is an error:'node.exe' is not recognized as an internal or external command,
operable program or batch file.
Download & Install Node.js
Try again your package installation
If still doesn't work, just Add node.exe installation path into environment variables manually.

Running batch file which runs 2 other batch files from SQL Server job

I have this step in sql server job
AAA.bat content is this
call BBB.bat
call CCC.bat
BBB.bat and CCC.bat each run ETL packages.
When I run above step it throws error
BBB.bat is not recognized as an internal or external command, operable
program or batch file... CCC.bat is not recognized as an internal or
external command, operable program or batch file
However, when I replace AAA.bat with either BBB.bat or CCC.bat it works as intended.
Are BBB.bat and CCC.bat in the same directory as AAA.bat? You need to set the working directory first. In AAA.bat add the following at the top of the file:
cd /d D:\Path\Client1
Or, call BBB.bat and CCC.bat using their full path.
A possibly better solution, depending on your environment and needs, would be to have your job contain two steps, each one calling the appropriate batch file (BBB or CCC) separately. That way, if you have a failure, its very obvious which batch file had a problem.

'tar' is not recognized as an internal or external command

I am trying to extract a zip file in Windows 10 using a batch script.
It a simple command:
tar zxf "logstash-5.4.0.tar.gz"
ECHO "installed"
But I am getting following error:
'tar' is not recognized as an internal or external command
I have seen that I have to install the tar but how can I do that?
How can I do this?
EDIT Tar is pre installed in windows or we have to externally add it? Still how can i extract without using third party tool.
You can download Tartool Application in your desktop and paste it into
C:\Windows\system32\
For eg:-(C:\Windows\system32\tartool.exe)
By doing this it work as internal command when you want to extract your file you can simply use
C:>TarTool.exe D:\sample.tar.gz ./
For more commands you can read documention part of that Tool
Starting windows 10 build 17063, TAR is an inbuilt tool and no need to install it separately. MSDN link
For example, to uninstall a file named XYZ.zip you can execute the following in Command Prompt.
tar -xvf XYZ.zip

sencha: command not found

I've installed Sencha by using the Terminal but I can't run if from the Terminal
samuel#samuel-pc:~/Downloads$ sudo ./SenchaCmd-6.5.0.180-linux-i386.sh -q
Starting Installer ...
The installation directory has been set to /root/bin/Sencha/Cmd/6.5.0.180.
Extracting files ...
Finishing installation ...
samuel#samuel-pc:~/Downloads$ sencha
sencha: command not found
Because you don't set environment variable.
If running sencha results in the error message sencha: command not
found on OSX/Linux or 'sencha' is not recognized as an internal or
external command, operable program or batch file on Windows, follow
these steps: ...
This is official guide: https://docs.sencha.com/cmd/guides/intro_to_cmd.html#intro_to_cmd_-_command_not_found

Resources