Unable to install botskills command - azure

Unable to install npm botskills command on Self-Hosted Azure agent.
Used following command to install packages get updated but when tried to check using "botskills" command it throws up and error saying botskills not available.
Screenshots
Used " npm install -g botskills#latest " to install the package where the following screenshot infers that the botskill packages have been updated.
But when tried to use the updated package it does not work
All the other supporting packages have been updated.
This issue occurs while using the Self-Hosted agent (Windows agent) only and works with no issue on local.
Steps to reproduce
1) Use any of the Microsoft Self-Hosted Agent.
2) Try installing botkskills using following command npm install -g botskills#latest
(Follow the attached screenshots)
3) Try using botskills to verify if the package is available.

I'm not sure if it is supported on a Azure agent, but this looks like a pathing issue.
On a typical machine, in powershell you can run the following to check what your path variable is set to:
$env:path.split(";")
You should typically have something like:
C:\Users\<username>\AppData\Roaming\npm as one of the paths.
For me, bot skills is at:
C:\Users\<myusername>\AppData\Roaming\npm\botskills.ps1
If you don't have that npm path in your path variable, that needs to be remedied somehow. If it's there, then you need to verify that botskills.ps1 is there.
When everything is setup correctly, you can use the following in PowerShell to find the path:
get-command botskills | select path

The error botskills not recognized is because the botskills package installation path is not in the System Environment variables PATH of you local machine. Azure pipeline agent is running as a different user (by default the NetworkService user), and the botskills package is installed by azure pipeline in a different path that unknown to system environment path.
You need to manually add the "path" to the system environment Path for the self-hosted agent machine.
You can also use --prefix to specify a custom npm package installation folder, and make sure add the path to system environment path for the self-hosted agent machine.
npm install botskills#latest -g --prefix C:\custompath\npm
Or you can add the installation path to Environment path in the powershell task using below script.
$env:Path += ";C:\path to botskills installation\npm"
Please check the answer to this thread for more information and the discussion for a similar issue here.

Related

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

I have followed the following Medium post on How to Configure postman / newman API tests in Azure DevOps or TFS and Publish HTML Results?
In my pipeline I have a task to install newman (Pass with command install newman -g) and a task to run api tests.(Fail - Error: 'newman' is not recognized as an internal or external command.)
I have tried: A few solutions that can be found here and here .
In my Environment variables I have:
npm\node_modules\newman\bin
\npm\node_modules\newman
%AppData%\npm
I did install newman using npm install -g newman and if I run newman -v I get a result of 5.2.2.
My Azure task to run API request: newman run Auth.postman_collection.json -e UserAuthEnvironmentVariables.postman_environment.json --reporters cli,junit --reporter-junit-export Results\junitReport.xml
'C:\Users<user>\AppData\Roaming\npm' contains 3 newman files and C:\Users\RRQA.RRIOMQAS01\AppData\Roaming\npm\node_modules\newman also contains files and folders.
My node version is v14.16.1 and npm version is 6.14.12
When I edit environment variables I do restart my the server to make sure changes did take affect.
Any other suggestions what I might try to figure out the issue.?
When you are running command line from azure and when you locally login to the system it might be running under different user identities (one in admin and another in your account) so sometimes what ever you have installed or set in environment variable won't be available in the admin identity login.
Make sure the installation is done for all users. (Add path to system variable ) else:
install it as local module in the project directory as :
npm install newman newman-reporter-htmlextra
and use :
"./node_modules/.bin/newman" run

Unable to run packages installed using npm on VM provisioned by Chef

I provisioned my VM on AWS using Chef and installed NodeJS using the NodeJS recipe (https://github.com/redguide/nodejs). When I do a global npm install of any package, I am not able to run that package using command line. Attached the screenshot below.
My poise-javascript cookbook has node_package and javascript_execute resources to take care of all the required path munging for you.
There are two options:
1)add the /usr/local/nodejs-binary-6.3.0/bin/ to PATH variable.
Or
2)Run /usr/local/nodejs-binary-6.3.0/bin/http-server.
The npm package binaries are not added to path by default. I would prefer option 2 to keep the path unpolluted

Making Global NPM packages available to all users on windows 2012 server

I am trying to install continues integration server. This server will pull data from GIT and it will try to build the application. Since I am using windows 2012 server, multiple users can trigger the build. For this purpose, I want to ensure all the node packages I install as admin are available to all users.
How can I:
Install node packages globally that are available to all users.
I want to use a locally hosted node registry. I don't want to use node registry.
After the installing the packages, how can I validate if all users can access the packages?
Had the same issue. Needed the CI build agent to run a global package on the CLI. Saw this post in a new feature request for system-wide npm -g for Windows.
In short:
Open an administrator level command prompt
Note the current global prefix: npm prefix -g
Set the global prefix to the CI user: npm config set prefix <C:\Users\CI_USER\AppData\Roaming\npm>
Install the needed packages: npm i -g PKG
Restore the prefix to the previous value.
For the 'Network Service' account use the folder:
C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm
You can add a global environment variable NODE_PATH to set the package require search path. You may see here for more.
https://gist.github.com/branneman/8048520#4-the-environment

Installing npm modules in a VM shared directory and grunt issues

I'm trying to put together a development environment and npm is causing me problems. Here is my scenario:
I have a development machine running Windows and VMWare Player. I have a Ubuntu Server VM (no UI) which is configured with Apache, PHP, NodeJS etc. As the VM has no UI I want to use the host OS for development. I set up a shared directory which in the VM is accessed as /mnt/hgfs/source/<project name>.
The problem comes when I attempt to run npm install within this directory. I see a lot of errors like Error: UNKNOWN, symlink '../requirejs/bin/r.js'. I know that my package.json file is OK because if I copy all files out of the share and into a regular unix directory (/var/www/<project name>) npm install works fine. So npm has a problem installing modules in the shared directory.
I thought I could get around this by installing the node packages globally but, for whatever reason, the GruntJS enthusiasts don't like that and it must be present locally. I then tried to create an npm link from global to local but that just results in a new error: Error: May not delete: /usr/lib/node_modules/grunt. I have full permissions on the /usr/lib/node_modules directory and all sub-directories.
I really don't want to write the entire project using a command-line text editor in the VM but it looks like I cannot have my code-base in a directory available to both the host and guest OS through VMWare.
I would very much appreciate any suggestions on how to either 1) allow npm modules to be installed in my shared directory, 2) run Grunt globally, or 3) solve the npm link error I'm seeing.
EDIT: Shortly after posting this I realised the fundamental issue here - it's not possible to create symbolic links within a VM shared directory when the host OS is Windows. As npm install uses symlinks by default it didn't work, and this is why the accepted solution does work.
Try the following:
npm install --no-bin-links
Grunt should be local since the plugins and gruntfile.js may require a certain version of Grunt in order to run your tasks. If another developer would like to run your tasks, they could just issue an npm install and they are set. (See this for more info.) grunt-cli is global which is used to run the local version of grunt

Nodejs Meanio module - init Command does not work

In the process of setting up MEAN Stack,
After installing meanio module on node 0.10.26, I can not pass through the command "mean init myApp".
1. npm install -g "meanio'
2. mean init myApp
This always gives me "Prerequisite not installed: undefined".
Could you pls look at it ?
Regards
Ram
Sometimes it is neccessary to clear npm cache to make sure you really get the latest version you can use the npm cache clear command. There have been a few releases over the last few days so clearing npm cache might help you
Here is a summary of the install procedure.
sudo npm install -g meanio#latest
mean init <your app name>
cd <your app name> && npm install
grunt
Checkout http://www.mean.io/#!/docs for full documentation and make sure you meet all the prerequites.
If you are a windows user and already installed Git on your machine, first add git to path in environment variable, then try it. It should work.
I too encountered the same issue.Though I have installed GIT on my mcahine, i was getting the error
"Prerequisite not installed: GIT" while running the command "mean init myApp".
This is because your command prompt doesnt know the path of GIT exe file.
I resolved this by adding the GIT path under Environment variables as shown here http://blog.countableset.ch/2012/06/07/adding-git-to-windows-7-path/
Right-Click on My Computer
Click Advanced System Settings link from the left side column
Click Environment Variables in the bottom of the window
Then under System Variables look for the path variable and click edit
Add the path to git's bin and cmd at the end of the string like this:
;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd
Please make sure that your give the correct path of GIT folder in the path under Environment variables.in your case it might not be same as mine.check where GIT files were created while installing.
Make sure you have a recent version of Git installed. That error should read, "Prerequisite not installed: git". I'll take a look at why it says undefined instead.
As user3211907 meantioned, please take a look at http://www.mean.io/#!/docs for full documentation.
Ram,
It is problem with git
install git and this problem should solve
To install git in Cent OS or any RedHat flavors use
yum install git

Resources