As part of one of our builds on Bamboo, I want to flatten the npm packages using the npm package flatten-packages. To do so, I need to execute "flatten-packages" from the parent folder of the node_modules folder. Attempting to do this with a script in Bamboo fails (also fails from command prompt when remoted into build server). Attempting to do it as a Node task leaves me confused about what I should be executing, and all that I try has been to no avail in actually flattening the packages. As a Node task, I have tried running the bin/flatten file as well as lib/flatten.js, but neither work. So, the basic question is, how can I execute "flatten-packages" (which works when I do it on my own computer) as part of an automated build on a Windows 2012 R2 server? Thanks in advance.
Just to share the resolution so it can help other customers, according to what we discussed on the support request you opened, you "resolved it by using the fully qualified path to the command in the script task in the Bamboo build."
Feel free to add more details here.
This might be old. But just letting others know how i made it work:
I installed flatten-packages on server globally using command: npm install -g flatten-packages
Noted down the installation path. It was: C:\Users\Administrator\AppData\Roaming\npm
Now if flatten-packages command is run from any folder on server, it would look for definition of this command in folder, if not found it would look for it in system paths.
I checked Control Panel > System > Advanced System Settings > Environment Variables > System variables > Variable value. The above installation path was not there. I added it there with semicolon separator.
Now flatten-packages command can be run from any folder on server. (So it will work from the build folder.)
I configured nodejs tasks in Bamboo UI this way:
According to me, flatten-packages as the last task on windows server is a must have task because it lets clean-up processes delete the node_modules gracefully.
Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot