Goal
I want to use jsdocs with npm.
Background
I am new to npm and its plugins. Recently I found out about jsdoc and I tried using it, with no success.
What I tried
First I installed the package using npm's mand npm install --save jsdoc
, and the install pleted successfully.
However, when I try to use it in my project (I am inside the project's folder) I type jsdoc example.js
and I get the following error:
/home/ubuntu/.nvm/versions/node/v4.4.5/bin/jsdoc: No such file or directory
This leads me to think that:
- I am in the wrong directory. If so, where should I be? (other than the project root folder)
- The installation had a problem, even though it was successfull.
I have also tried to run npm jsdoc example.js
but I get another error (this time from npm, saying I am not using it correctly).
I also installed jsdoc globally (using the -g
flag) and it worked, but I truly want to avoid this because not all projects are using jsdoc.
Summary
To conclude, I am looking for a way to run jsdoc locally to a project with npm. Does anyone know of a way to do this?
Goal
I want to use jsdocs with npm.
Background
I am new to npm and its plugins. Recently I found out about jsdoc and I tried using it, with no success.
What I tried
First I installed the package using npm's mand npm install --save jsdoc
, and the install pleted successfully.
However, when I try to use it in my project (I am inside the project's folder) I type jsdoc example.js
and I get the following error:
/home/ubuntu/.nvm/versions/node/v4.4.5/bin/jsdoc: No such file or directory
This leads me to think that:
- I am in the wrong directory. If so, where should I be? (other than the project root folder)
- The installation had a problem, even though it was successfull.
I have also tried to run npm jsdoc example.js
but I get another error (this time from npm, saying I am not using it correctly).
I also installed jsdoc globally (using the -g
flag) and it worked, but I truly want to avoid this because not all projects are using jsdoc.
Summary
To conclude, I am looking for a way to run jsdoc locally to a project with npm. Does anyone know of a way to do this?
Share Improve this question asked Jun 23, 2016 at 11:00 Flame_PhoenixFlame_Phoenix 17.6k40 gold badges145 silver badges284 bronze badges2 Answers
Reset to default 5To run jsdoc in the mand line, the location of the jsdoc needs to be known. So when you have installed jsdoc globally, system would be able to find the file.
However if you want to run it locally, you need to include the file location before the jsdoc mand.
For example, try using ./node_modules/jsdoc/jsdoc.js example.js
For local installation, the binary is in node_modules/.bin/jsdoc
. If you install it globally, it should be accessible as jsdoc
mand. It's stated pretty early in the docs. https://www.npmjs./package/jsdoc