I want to use jsdocs with npm.
I am new to npm and its plugins. Recently I found out about jsdoc and I tried using it, with no success.
First I installed the package using npm's command npm install --save jsdoc
, and the install completed 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 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.
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?
To run jsdoc in the command 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 command.
For example, try using ./node_modules/jsdoc/jsdoc.js example.js