External tools wont run jsdoc

 Hi all,

I am having an issue run jsdoc as an external tool.
If i open the console in phpstorm and type the following command it is successful: 

./node_modules/.bin/jsdoc ./resources/js -d ./docs/jsdoc

If i type `whereis php` and `which php` i get the result:  /usr/bin/php an d /usr/local/bin/php

So i create a new External Tool and input:

Program: /usr/bin/php (have also tried /usr/local/bin/php)
Parameters: ./node_modules/.bin/jsdoc ./resources/js -d ./docs/jsdocWorking Directory: /Applications/XAMPP/xamppfiles/htdocs/path/to/project (Project path obviously works, but would not like to disclose the projects name)

This gives me the following result. I have tried changing the php path to the xampp one too and that gave the same result. :(


/usr/bin/php ./node_modules/.bin/jsdoc ./resources/js -d ./docs/jsdoc
/* global require: true */
/* eslint strict: ["error", "function"] */

// initialize the environment for Node.js
(function() {
'use strict';

var fs = require('fs');
var path = require('path');

var env;
var jsdocPath = __dirname;
var pwd = process.cwd();

// Create a custom require method that adds `lib/jsdoc` and `node_modules` to the module
// lookup path. This makes it possible to `require('jsdoc/foo')` from external templates and
// plugins, and within JSDoc itself. It also allows external templates and plugins to
// require JSDoc's module dependencies without installing them locally.
require = require('requizzle')({
requirePaths: {
before: [path.join(__dirname, 'lib')],
after: [path.join(__dirname, 'node_modules')]
infect: true

// resolve the path if it's a symlink
if ( fs.statSync(jsdocPath).isSymbolicLink() ) {
jsdocPath = path.resolve( path.dirname(jsdocPath), fs.readlinkSync(jsdocPath) );

env = require('./lib/jsdoc/env');
env.dirname = jsdocPath;
env.pwd = pwd;
env.args = process.argv.slice(2);

* Data about the environment in which JSDoc is running, including the configuration settings that
* were used to run JSDoc.
* @deprecated As of JSDoc 3.4.0. Use `require('jsdoc/env')` to access the `env` object. The global
* `env` object will be removed in a future release.
* @namespace
* @name env
global.env = (function() {
'use strict';

return require('./lib/jsdoc/env');

* Data that must be shared across the entire application.
* @deprecated As of JSDoc 3.4.0. Avoid using the `app` object. The global `app` object and the
* `jsdoc/app` module will be removed in a future release.
* @namespace
* @name app
global.app = (function() {
'use strict';

return require('./lib/jsdoc/app');

(function() {
'use strict';

var env = global.env;
var cli = require('./cli');

function cb(errorCode) {
cli.exit(errorCode || 0);


if (!env.opts.test) {


if (env.opts.debug) {
* Recursively print an object's properties to stdout. This method is safe to use with
* objects that contain circular references.
* This method is available only when JSDoc is run with the `--debug` option.
* @global
* @name dump
* @private
* @param {...*} obj - Object(s) to print to stdout.
global.dump = function() {


Process finished with exit code 0



Hi there,

>External tools wont run jsdoc

It runs it fine :)

And the "Process finished with exit code 0" message is a confirmation of that (0 means no error)


Question is -- why do you use PHP to run a script  (JSDoc) that is written in JavaScript?? AFAIK (based on the output and tool location --  "./node_modules/.bin/jsdoc") you need node.js to run JSDoc


Well then I dont understand. It doesnt work for me. If i run the command without specifying the program php "usr/bin/php" and just the other arguments then its fine. As soon as I include the php path it breaks. And phpstorm forces me to specify the php path for it to execute.


This works: ./node_modules/.bin/jsdoc ./resources/js -d ./docs/jsdoc

This does not: /usr/bin/php ./node_modules/.bin/jsdoc ./resources/js -d ./docs/jsdoc


>And phpstorm forces me to specify the php path for it to execute.

What? Where? Screenshots please.

>This does not: /usr/bin/php ./node_modules/.bin/jsdoc ./resources/js -d ./docs/jsdoc

This is NOT supposed to work (I mean -- actually execute JSDoc) . Such command will just output the content of "./node_modules/.bin/jsdoc" as it has no PHP code.

If anything you should try running this instead: "./node_modules/.bin/jsdoc ./resources/js -d ./docs/jsdoc"

  • Program: "./node_modules/.bin/jsdoc"
  • Parameters: "./resources/js -d ./docs/jsdoc"

I apologise. I misread your post - pointing the command to the node file instead of the php file worked perfectly. Im sorry I didnt see such an obvious thing before, but im new to using composer and node etc. I have been writing my scripts manually I guess until recently. 

Also sorry for the multiple posts.

Working command: /usr/local/bin/node ./node_modules/.bin/jsdoc ./resources/js -d ./docs/jsdoc

EDIT: Yes im sorry you are right. Removing node program all together and putting jsdoc as the program worked. Obviously... :-\

Thank you. 


Please sign in to leave a comment.