NPM task fails to run due to incorrect executable location

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

When running the NPM task, NPM outputs the help text instead of running the expected command.

The following appears in the build log:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 command 11-Apr-2017 12:14:00 Beginning to execute external process for build \n ... running command line: \n/path/to/npm/bin/npm /path/to/npm/bin/npm ... build 11-Apr-2017 12:14:00 build 11-Apr-2017 12:14:00 Usage: npm <command> build 11-Apr-2017 12:14:00 build 11-Apr-2017 12:14:00 where <command> is one of: build 11-Apr-2017 12:14:00 add-user, adduser, apihelp, author, bin, bugs, c, cache, build 11-Apr-2017 12:14:00 completion, config, ddp, dedupe, deprecate, docs, edit, build 11-Apr-2017 12:14:00 explore, faq, find, find-dupes, get, help, help-search, build 11-Apr-2017 12:14:00 home, i, info, init, install, isntall, issues, la, link, build 11-Apr-2017 12:14:00 list, ll, ln, login, ls, outdated, owner, pack, prefix, build 11-Apr-2017 12:14:00 prune, publish, r, rb, rebuild, remove, repo, restart, rm, build 11-Apr-2017 12:14:00 root, run-script, s, se, search, set, show, shrinkwrap, build 11-Apr-2017 12:14:00 star, stars, start, stop, submodule, tag, test, tst, un, build 11-Apr-2017 12:14:00 uninstall, unlink, unpublish, unstar, up, update, v, build 11-Apr-2017 12:14:00 version, view, whoami build 11-Apr-2017 12:14:00 build 11-Apr-2017 12:14:00 npm <cmd> -h quick help on <cmd> build 11-Apr-2017 12:14:00 npm -l display full usage info build 11-Apr-2017 12:14:00 npm faq commonly asked questions build 11-Apr-2017 12:14:00 npm help <term> search for help on <term> build 11-Apr-2017 12:14:00 npm help npm involved overview build 11-Apr-2017 12:14:00 build 11-Apr-2017 12:14:00 Specify configs in the ini-formatted file: build 11-Apr-2017 12:14:00 /path/to/.npmrc build 11-Apr-2017 12:14:00 or on the command line via: npm <command> --key value build 11-Apr-2017 12:14:00 Config info can be viewed via: npm help config build 11-Apr-2017 12:14:00 build 11-Apr-2017 12:14:00 npm@1.3.24 /path/to/npm

Cause

The Bamboo task expects the Node.js executable, and creates the path to NPM from the Node.js path.

The NPM command runs as

1 /path/to/node.js /path/to/npm <commands>

In this specific case, the issue can be caused by the Node.js executable Capability pointing to the NPM task instead of Node.js, where the command would be run as

1 /path/to/npm /path/to/npm <commands>

Resolution

Update the Node.js capability in Administration >> Overview >> Server capabilities to point to the Node.js executable.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.