hi, i actually want to run nodejs script, for that i needed to run npm first. now npm shows error of not having scriptTask.ps1.
Entire error is something like:
Unable to find executable at &('ROOT\bamboo-home\temp\HKPROJ-HKPLAN-JOB1-9-ScriptBuildTask-2242666093943315694.ps1'). Will try to run it anyway.
Can anyone help me knowing what is ps1 file and what does it do? and how can i add one into this directory.
Thanks for your question and welcome here in Community!
Indeed, npm and Node .js are bundled. That said, once you install Node.js, e.g. from nodejs.org, you can type node -v or npm -v on command-line and should see the installed versions of both as an output.
Prior to use npm, you first need to run command npm init which creates a folder node_modules from the directory where you call the command, typically your local Node.js project folder, and file packet.json which contains the basic information that you entered interactively when running npm init and also sections like "scripts" and "dependencies".
Without that, npm should not work.
Next, did you try to run npm from outside Bamboo, precisely speaking on the sever Bamboo Server is installed and runs on? It's always good to figure out if things can really get executed the way they are set up. Note that if you cannot run something like e.g. npm install moment where moment is just an example of a Node.js module for date and time formatting on command-line on your Bamboo host, Bamboo cannot run it too. If so, you should troubleshoot the issue outside Bamboo first.
Now let me assume that thus far everything is correct. From the type of error you get, it looks like you're trying to run npm install, npm test or any other npm command from out of as Bamboo Script task and your Bamboo host seems to be a Windows server since whatever you try to launch there kicks off a PowerShell (PS) script.
And here I believe that the error message is a bit misleading. The error should not be related to the PS script itself, I rather think that the npm executable as such cannot be found.
To resolve that you first need to determine where you installed Node.js. And with that in mind, you need to set either Bamboo's Server, agent-speficic or shared capability accordingly. Other than this, the environment variable NODE_HOME needs to be set, with exactly the same value as the Node.js capability before. This is where Bamboo primarily looks for the node and npm binaries!
Please find details in the following KB Getting started with Node.js and Bamboo especially in section "Node.js capability".
On a side-note, for running npm as well as Node.js, Bamboo offers dedicated tasks. Please take a look into the above KB for this too. It should me more practical using those instead of Bamboo Script tasks. Note that for both of these to work, the Node.js executable capability needs to be set properly too.
Hope that helps. Take care and let us know what more we can do for you.