简体   繁体   中英

How do I use JSDoc on Windows?

Forgive me if this is a daft question but I'm utterly baffled as to how I can use JSDoc on Windows. I'm aware of JSDoc-Toolkit but it's a bit out of date and the google code repository recommends to use JSDoc 3 instead. I have downloaded JSDoc from Github and unzipped the jsdoc-master folder onto my local disk but can't find any solid information as to how to use it to parse my files.

You can download it as an npm package for the Node.js JavaScript runtime environment.

  1. Install Node.js which comes with npm
  2. Open your a command line
  3. Install JsDoc by typing the following command

    npm install -g jsdoc

  4. Run JsDoc / generate documentation. more info

    jsdoc path/to/file.js

  5. Configure jsdoc (Optional)

The installation is not good documented on the project-page .

It is much better exlained on the github-page .

I don't know very much about NodeJS/npm ecosystem. However, I did the following steps below and it worked for me (on windows):

  1. Downloaded NodeJS zip file and extracted, it made a directory 'node-v16.15.1-win-x64' with node.exe and and npm.cmd inside
  2. Executed command 'npm install -g jsdoc', under the 'node_modules' directory under the 'node-v16.15.1-win-x64' it installed the jsdoc (in a folder) and also made the jsdoc.cmd file inside 'node-v16.15.1-win-x64'.
  3. This jsdoc.cmd works with the full path but it does not work without the full path jsdoc gets installed and is working with the above steps but to access it from any where without giving the full path, I had to set the 'node-v16.15.1-win-x64' on Windows PATH, that works.

I am not sure if question of OP is answered but JSDoc works for me this way.

I'm not saying this is necessarily the best way, but it worked for me:

  1. Install node.js

  2. Open a command prompt

  3. As a test, create a folder in your root drive ( c:\\test ) and go to it ( cd\\test ). I guess there was some sort of permission issue as I couldn't get the following steps to work in my desktop folder.

  4. Install the JSDoc package: npm install jsdoc

  5. There should be a folder in test called node_modules

  6. Go to the .bin subfolder in node_modules

  7. There should be a file called jsdoc.cmd . Simple use jsdoc myfile.js in the command prompt to execute the JSDoc script on your file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM